GetWebResourceUrl not working

M

matt_randle

Can anyone tell me why this is not working ?

I have an aspx page with the following definition,

<asp:ImageButton ID="MenuBtnOpen" ImageUrl='<%#
Page.ClientScript.GetWebResourceUrl(typeof(WebResources.Resource),
"A.gif")%>' />

When the page is processed by asp.net, the src attribute for the image
is always blank.

If I put this code in the Page_Load event,

MenuBtnOpen.ImageUrl =
Page.ClientScript.GetWebResourceUrl(typeof(WebResources.Resource),
"A.gif");

It works ok.

Ive spent an entire day trying to work this out.

Please tell me im doing something stupid and its not a bug in asp.net.
 
T

Teemu Keiski

<%#... %> refers to a databinbing exptression and you need to call
control.DataBind() or Page.DataBind() for it to be evaluated.,
Page.DataBind() binds the entire page (also child controls) while
control.dataBind() binds a specific control and its child controls.
 
M

matt_randle

Doh..

Thanks. Very stupid of me.


<%#... %> refers to a databinbing exptression and you need to call
control.DataBind() or Page.DataBind() for it to be evaluated.,
Page.DataBind() binds the entire page (also child controls) while
control.dataBind() binds a specific control and its child controls.

--
Teemu Keiski
AspInsider, ASP.NET MVPhttp://blogs.aspadvice.com/jotekehttp://teemukeiski.net
















- Show quoted text -
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top