Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : ImageButton and server tags


Julie
5/11/2004 11:03:58 PM
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.

Ashish M Bhonkiya
5/12/2004 12:11:58 PM
Hi Julie,

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

Regards
Ashish M Bhonkiya


[quoted text, click to view]

Julie
5/12/2004 12:35:35 PM
[quoted text, click to view]

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

Any other suggestions?


[quoted text, click to view]
Ashish M Bhonkiya
5/18/2004 8:12:46 PM
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

[quoted text, click to view]

AddThis Social Bookmark Button