Hello
I added columns dynamically to gridview at run time and have added textboxs to every column using row data bound.
but now when i try to get this value in another button click i get null reference error.
I know that as pageload do not retains values ,i am not getting the required result.but what is solution on it?
here is my code..
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow){
for (int i = 0; i < 6; i++){TextBox txt = new TextBox();txt.CssClass = "SmallTextBoxDate";txt.ID = "TextBox" + (i).ToString();if (dt != null && dt.Rows.Count > 0){{txt.Text = dt.Rows[e.Row.RowIndex][i - 1].ToString();}}e.Row.Cells[i].Text = "";e.Row.Cells[i].Controls.Add(txt);}
}}}protected void btnAdd_Click(object sender, EventArgs e){string A=(((TextBox)gvrItem.FindControl("txtE")).Text).tostring();//Here I m getting null value}please help
piyusha patravaliPosted Oct 3, 2015, 5:34 AM
Nilesh JadavPosted Oct 2, 2015, 9:24 AM