ImageButton and server tags

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?
 
A

Ashish M Bhonkiya

Hi Julie,

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

Regards
Ashish M Bhonkiya
 
J

Julie

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?
 
A

Ashish M Bhonkiya

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top