protected void Copy_Click(object sender, EventArgs e)
{
foreach(HtmlTableRow row in table1.Rows)
{
foreach (HtmlTableCell cell in row.Cells)
{
Control control = cell.Controls[0];
if (control is TextBox)
{
ViewState[control.ID] = ((TextBox)control).Text;
}
}
}
}
and
Populating the text box from view state on Button Click
protected void Paste_Click(object sender, EventArgs e)
{
foreach (HtmlTableRow row in table1.Rows)
{
foreach (HtmlTableCell cell in row.Cells)
{
Control control = cell.Controls[0];
if (control is TextBox)
{
string value = (string) ViewState[control.ID];
if(value != null)
{
((TextBox) control).Text = value;
}
}
}
}
}
No comments:
Post a Comment