Specify Image location in Web.Config

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Specify Image location in Web.Config

    Hello Guys,

    Just curious over the fact if i can store Image Location in Web.Config and
    then how can i extract that location in HTML

    <td style="width:1% " align="left" valign="middle" >
    <img alt="" src="<%# image Location'
    %>/Images/lhw_logo_black. jpg" id=headerImage runat=server /></td>
    <td style="width: 1%" align="right" valign="middle" >

    Is it possible to do something like this or not? I am developing in C#2.0 .
    I am trying to avoid this in Codebehind.

    Thanks

    Manny
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: Specify Image location in Web.Config

    just create a function in you base page like ImagePath(strin g s) then you can
    use it in a binding expression (which will require a bind) or standand.

    <img src='<%# ImagePath("myIm age.gif")%>' runat="server"/>
    <img src='<%= ImagePath("myIm age.gif")%>' />

    another option is a prerender handler that walks the control collection
    (requires each image have a runat=server). and update the src.


    -- bruce (sqlwork.com)


    "Manny Chohan" wrote:
    Hello Guys,
    >
    Just curious over the fact if i can store Image Location in Web.Config and
    then how can i extract that location in HTML
    >
    <td style="width:1% " align="left" valign="middle" >
    <img alt="" src="<%# image Location'
    %>/Images/lhw_logo_black. jpg" id=headerImage runat=server /></td>
    <td style="width: 1%" align="right" valign="middle" >
    >
    Is it possible to do something like this or not? I am developing in C#2.0 .
    I am trying to avoid this in Codebehind.
    >
    Thanks
    >
    Manny

    Comment

    • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

      #3
      RE: Specify Image location in Web.Config

      in Page ASPX:
      <asp:Image ID="Image1" runat=server ImageUrl = '<%$ appSettings:myI mage1
      %>' />

      in web.config:

      <appSettings >
      <add key="myImage1" value="~/images/check2.gif"/>
      </appSettings>

      -- Peter
      Site: http://www.eggheadcafe.com
      UnBlog: htp://petesbloggerama .blogspot.com
      Short Urls & more: http://ittyurl.net


      "Manny Chohan" wrote:
      Hello Guys,
      >
      Just curious over the fact if i can store Image Location in Web.Config and
      then how can i extract that location in HTML
      >
      <td style="width:1% " align="left" valign="middle" >
      <img alt="" src="<%# image Location'
      %>/Images/lhw_logo_black. jpg" id=headerImage runat=server /></td>
      <td style="width: 1%" align="right" valign="middle" >
      >
      Is it possible to do something like this or not? I am developing in C#2.0 .
      I am trying to avoid this in Codebehind.
      >
      Thanks
      >
      Manny

      Comment

      Working...