Conditionally showing an image in DataGrid

partha.majumdar

Active member
Joined
Aug 13, 2006
Messages
33
Location
Kolkata
Programming Experience
10+
Dear Sir,

I have defined a template column in a data grid and in the template I have placed an image. I want the image to be displayed if the row is a new row. I can track the status of the row being new from the column NEW in a datatable. The DataSource for the DataGrid is this DataTable.

What do I write to make this possible.

I wrote as follow and it gives a run time error.
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Test1.jpg"
Visible='<%# New="True" %>' />



Thanks for your help.

Regards,
Partha
 
Well I found the solution.
Thanks

<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Test1.jpg"
Visible='<%# DataBinder.Eval(Container.DataItem, "New") = "True" %>' />
 
Back
Top