storing text of textboxes in list ang show them in textbox again(in gridview)
-
I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:
protected void Button1_Click(object sender, EventArgs e)
{
List qy = new List();
foreach (GridViewRow gvr in GridView1.Rows)
{
TextBox q = (TextBox)gvr.FindControl("textbox5");
if (Session["quantity"] == null)
{
qy.Add(q.Text.Trim());
Session["quantity"] = qy;
}
else
{
((List)Session["quantity"]).Add(q.Text.Trim());
}
}----------------------------- and in pageloade i wrote this but I don't know how to continue it:
if(Session\["quantity"\]!=null) { List temp=(List)Session\["quantity"\]; foreach(GridViewRow gvr in GridView1.Rows) { TextBox tq=(TextBox)gvr.FindControl("textbox5");
-
I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:
protected void Button1_Click(object sender, EventArgs e)
{
List qy = new List();
foreach (GridViewRow gvr in GridView1.Rows)
{
TextBox q = (TextBox)gvr.FindControl("textbox5");
if (Session["quantity"] == null)
{
qy.Add(q.Text.Trim());
Session["quantity"] = qy;
}
else
{
((List)Session["quantity"]).Add(q.Text.Trim());
}
}----------------------------- and in pageloade i wrote this but I don't know how to continue it:
if(Session\["quantity"\]!=null) { List temp=(List)Session\["quantity"\]; foreach(GridViewRow gvr in GridView1.Rows) { TextBox tq=(TextBox)gvr.FindControl("textbox5");
You can use the Grd Row Created Event
-
I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:
protected void Button1_Click(object sender, EventArgs e)
{
List qy = new List();
foreach (GridViewRow gvr in GridView1.Rows)
{
TextBox q = (TextBox)gvr.FindControl("textbox5");
if (Session["quantity"] == null)
{
qy.Add(q.Text.Trim());
Session["quantity"] = qy;
}
else
{
((List)Session["quantity"]).Add(q.Text.Trim());
}
}----------------------------- and in pageloade i wrote this but I don't know how to continue it:
if(Session\["quantity"\]!=null) { List temp=(List)Session\["quantity"\]; foreach(GridViewRow gvr in GridView1.Rows) { TextBox tq=(TextBox)gvr.FindControl("textbox5");
Just true the EnableViewState property of textvox or your grid.
-
Just true the EnableViewState property of textvox or your grid.
the viewstates are true.I want to show text in textboxes agian after postback.