Chage row color, image on conditions and a default string if emply in Datagrid
-
I am trying to do something like yahoo emial. If the email has not been read display the row in white and image "A" at beginig of the row else display in light blue and display image "B" If the subject line is empty then display a string "none" so user can have something to click on to read the email. Is this possible with datagrid? If not please let me know so I don't have to waste my time trying to find a solution for an unsolvable problem.
-
I am trying to do something like yahoo emial. If the email has not been read display the row in white and image "A" at beginig of the row else display in light blue and display image "B" If the subject line is empty then display a string "none" so user can have something to click on to read the email. Is this possible with datagrid? If not please let me know so I don't have to waste my time trying to find a solution for an unsolvable problem.
awu25 wrote: If the email has not been read display the row in white and image "A" at beginig of the row else display in light blue and display image "B" Create templete clmn in your DG then add tag and check it run as a server control and add your own ItemDataBound event hander of DG
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim r As DataRow = CType(e.Item.DataItem, DataRowView).Row Dim img As System.Web.UI.WebControls.Image = e.Item.FindControl("img1") If IsMailRead(r("ID")) Then e.Item.Attributes.Add("style", "background-color:white") img.ImageUrl = "/imgA.gif" Else e.Item.Attributes.Add("style", "background-color:grey") img.ImageUrl = "/imgB.gif" End If