ImageButton and server tags

  • Thread starter Thread starter Julie
  • Start date Start date
J

Julie

I've got one that I've spent all to much time on:

I have an aspx page that includes the following (code behind is C#):

<asp:Imagebutton runat="server" ImageUrl='<%# Application["AppPath"] +
"/images/up.gif" %>' />

When rendered, the image src tag isn't there (at all!).

If I change to:

<asp:Imagebutton runat="server" ImageUrl="approot/images/up.gif" />

the page is rendered just fine w/ the src attribute correctly set.

So, for some reason, when using the server tags, the src attribute isn't spit
out for some reason that is beyond me. The funny thing is that other similar
pages w/ similar tags all operate as expected.

Anyone have a clue?
 
Hi Julie,

can u try this one ?
<asp:Imagebutton runat="server" ImageUrl='<%# (string)
Application["AppPath"] +
"/images/up.gif" %>' />

Regards
Ashish M Bhonkiya
 
Ashish said:
Hi Julie,

can u try this one ?
<asp:Imagebutton runat="server" ImageUrl='<%# (string)
Application["AppPath"] +
"/images/up.gif" %>' />

No difference, still doesn't render the src attribute.

Any other suggestions?

Julie said:
I've got one that I've spent all to much time on:

I have an aspx page that includes the following (code behind is C#):

<asp:Imagebutton runat="server" ImageUrl='<%# Application["AppPath"] +
"/images/up.gif" %>' />

When rendered, the image src tag isn't there (at all!).

If I change to:

<asp:Imagebutton runat="server" ImageUrl="approot/images/up.gif" />

the page is rendered just fine w/ the src attribute correctly set.

So, for some reason, when using the server tags, the src attribute isn't spit
out for some reason that is beyond me. The funny thing is that other similar
pages w/ similar tags all operate as expected.

Anyone have a clue?
 
Hi Julie,

It seems that its not allowing to do it that way. After doing some research
i came to a conclusion
inside an <asp:xxx> tag, you're not really writing HTML per se, you're
writing child controls in this case we its adding a
'DataBoundLiteralControl' as a child to the existing control which is not
allowed.

Regards
Ashish M Bhonkiya

Julie said:
Ashish said:
Hi Julie,

can u try this one ?
<asp:Imagebutton runat="server" ImageUrl='<%# (string)
Application["AppPath"] +
"/images/up.gif" %>' />

No difference, still doesn't render the src attribute.

Any other suggestions?

Julie said:
I've got one that I've spent all to much time on:

I have an aspx page that includes the following (code behind is C#):

<asp:Imagebutton runat="server" ImageUrl='<%# Application["AppPath"] +
"/images/up.gif" %>' />

When rendered, the image src tag isn't there (at all!).

If I change to:

<asp:Imagebutton runat="server" ImageUrl="approot/images/up.gif" />

the page is rendered just fine w/ the src attribute correctly set.

So, for some reason, when using the server tags, the src attribute
isn't
spit
out for some reason that is beyond me. The funny thing is that other similar
pages w/ similar tags all operate as expected.

Anyone have a clue?
 
Back
Top