Cannot access "static" control via ID

lordcalder

New member
Joined
Apr 12, 2011
Messages
1
Programming Experience
10+
Hi all,

I have a very minor problem, which is giving me a major headache... I have this control within a repeater, within a table :

<asp:image ID="newsImage" runat="server" imageurl='<%# Eval("n_image","/images/news/{0}") %>' BorderWidth="0px" ClientIDMode="Static" AlternateText="News image" GenerateEmptyAlternateText="True" ImageAlign="Middle" Width="250px" />

but when I try to access the control in my VB script, it does not appear. The parent table control appears, but not this one... I have tried many an option including using FindControl on the page, making the ClientIDMode=Inherit and using the ridiculous ctl00_PageContent_newsPage_Repeater1_newsItem name to try and access this, but it always comes back with the 'Null object' error...

The image tag as it stands at the moment works perfectly and extracts the relevant image from the database, so there is no problem with the tag... I am actually writing a custom CMS and want the newly uploaded image to appear immediately, in place of the old image when my client is editing their news items.

All I want to do is set the src of the image to the filename from my FileUpLoad control (which works perfectly)

Any direction or answers will be greatly received.

Thanks in advance,

Martin

P.S. When I view the source, in it's current form, I see the following tag:

<img id="newsImage" src="/images/news/kings%20speech_BAFTA.jpg" alt="News image" align="middle" style="border-width:0px;width:250px;" />

So I know the id is there, I know the image is being identified and presented correctly, and I know the control was generated at the server... So why does this not work?


 
Back
Top