Get Value of Cell in ItemTemplate for Datagrid
-
I want to make a row red based on value of cell for a datagrid. Now I have code that works for bound columns but if its a ItemTemplate its no good. Here is code that works for bound Columns
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim sStr As String sStr = Convert.ToString(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Status")) If sStr = "DEAD" Then e.Row.BackColor = System.Drawing.Color.Red End If End Sub
Can someone please assist me and supply code for checking data on a itemtemplate please. thanks coders -
I want to make a row red based on value of cell for a datagrid. Now I have code that works for bound columns but if its a ItemTemplate its no good. Here is code that works for bound Columns
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim sStr As String sStr = Convert.ToString(System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Status")) If sStr = "DEAD" Then e.Row.BackColor = System.Drawing.Color.Red End If End Sub
Can someone please assist me and supply code for checking data on a itemtemplate please. thanks codersFirst set a command name and commandArgument to some cell text like this then write this code behind protected void grdVDataQueries_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Open")) { string args = e.CommandArgument.ToString(); } }
God Bless you. Always do good to others