Hi
I have below code . I have attached image. When i loop thru Gridview it should show Data value but it shows
When i am tryying this it gives error - Object reference mot set to an instance of the Object.
foreach (GridViewRow gr in grdPlanning.Rows)
{
//string sessionDate = "";
if (gr.RowType == DataControlRowType.DataRow)
{
if (gr.Cells[0].Text == "146")
{
string sign5 = ((TextBox)gr.FindControl("txtDate")).Text;
}
}
}
protected void gr_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.DataRow)
return;
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
TextBox txtDate = new TextBox();
txtDate.CssClass = "form-control";
txtDate.DataBind();
e.Row.Cells[e.Row.Cells.Count - 1].Controls.Add(txtDate);
}
}
Thanks