c# - display image in column of gridview based on condition -


hi having gridview 6 columns in first column check box . want insert image beside check box whenever there error in validation regards row image should displayed if there no error image should not displayed.how this.please me out in advance.

something below should it. in aspx file create templatefield

<asp:templatefield headertext="header" > <itemtemplate> <asp:checkbox runat="server" id="cbwhatever" ></asp:checkbox> <asp:image runat="server" id="img1" imageurl="~/filename1" visible="false"/> <asp:image runat="server" id="img2" imageurl="~/filename2" visible="false"//> </itemtemplate> </asp:templatefield> 

then in code behind, when validation, depending on validation results either do:

image img = (image)e.row.findcontrol("img1"); img1.visible = true; 

or

image img = (image)e.row.findcontrol("img2"); img2.visible = true; 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -