Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
675
can't find an image in a TemplateDataField
posted

Hello,

I've a webdatagrid with a TemplateDataField:

<Columns>
 <ig:BoundDataField DataFieldName="Id" Hidden="true" Key="Id">
  <Header Text="Id" />
 </ig:BoundDataField>
 <ig:TemplateDataField Key="Zuweisen" Width="70px">
  <ItemTemplate>
   <asp:Button ID="btnZuweisen" runat="server" Text="=>" >
   <img id="imgNeueAnfrage" alt="" src="./Bilder/ico_16_112.gif" />
  </ItemTemplate>
  <Header Text="Bild"/>
 </ig:TemplateDataField>
</Columns>

In the InitializeRow-Event, I try to find the Controls:

Dim Button As Button = CType(e.Row.Items(1).FindControl("btnZuweisen"), Button)
Dim Bild As HtmlImage = CType(e.Row.Items(1).FindControl("imgNeueAnfrage"), HtmlImage )

I find the button, but not the image. Why?

Bodo

Parents
  • 29417
    Offline posted

    Hello bodojaeger ,

     

    Thank you for posting in our forum.

     

    The image seems to be missing it’s runat=”server” tag. For that reason it’s not available on the server side. Add the tag and try getting it on the server side again.

    Also make sure that you add the closing tag for the button.

     

    Let me know if you’re still encountering the issue after these modifications.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

Reply Children