ASP: Updating an image's IMAGEURL within a REPEATER

Posted by Django Reinhardt on Stack Overflow See other posts from Stack Overflow or by Django Reinhardt
Published on 2010-05-27T10:59:54Z Indexed on 2010/05/27 11:01 UTC
Read the original article Hit count: 341

Filed under:
|
|
|
|

Hi, I hope someone can help me. It's a pretty newbie question, I'm afraid. I have an image inside a repeater, and I would like to change its IMAGEURL based on parameter that's being passed to it.

<asp:Repeater ID="Repeater" runat="server">
     <HeaderTemplate>
         <asp:Image ID="imgType" runat="server" />   
     </HeaderTemplate>         
     <ItemTemplate>     
         <%# Eval("DisplayName")%>            
     </ItemTemplate>
     <SeparatorTemplate>
         <hr />
     </SeparatorTemplate>
 </asp:Repeater>

There is a SWITCH statement in the code behind that is altering the IMAGEURL depending on what's being passed to it. Inevitably, however, the images ID ("imgType") is not visible to the SWITCH statement (presumably because it's inside a REPEATER).

Any suggestions on the best way to implement this would be greatly appreciated.

Sorry for such a newbie question.

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET