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
875
How to change the image of a WebImageButton in template-field?
posted

I have a WebImageButton in a template-field and want to change the image of it depending on a value of another cell. But I cant get the "WebImage4"-Button.

How is it poassible to change the image like WebImageButton4.Appereance.Image.Url..... edit: The Button is within a WebDataGrid....

 

I got it: In the InitializeRow.Event ...

WebImageButton wib = (WebImageButton)e.Row.Items[9].FindControl("WebImageButton4");

wib.Appereance.Image.Url = "OK.jpg";

  • 29417
    Verified Answer
    Offline posted

    Hello Kociemba ,

     

    Thank you for posting in our forum. 

    When you set a template column one instance of an image button will be created for each row so getting the images and setting their appearance on InitializeRow is the correct approach.Please refer to the attached sample. In it on InitializeRow depending on the first column different url are set for the images. 

    Let me know if you have any questions or concerns.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://es.infragistics.com/support

     

    WDG_WebImageButton.zip