P
Philip Townsend
I have a datagrid with update buttons that allow editing of records in a
database table. I would like it if when users click an 'Update' button,
all the generated textboxes are cleared. Here is my code that does not
seem to work (and does not throw exceptions)--what am I doing wrong?
protected void EditRecord(object sender, DataGridCommandEventArgs e)
{
dgItems.EditItemIndex = e.Item.ItemIndex;
dgItems.DataSource = CreateDataSource();
dgItems.DataBind();
foreach(Control c in Page.Controls)
{
if(c is TextBox)
{
((TextBox)c).Text="";
}
}
}
database table. I would like it if when users click an 'Update' button,
all the generated textboxes are cleared. Here is my code that does not
seem to work (and does not throw exceptions)--what am I doing wrong?
protected void EditRecord(object sender, DataGridCommandEventArgs e)
{
dgItems.EditItemIndex = e.Item.ItemIndex;
dgItems.DataSource = CreateDataSource();
dgItems.DataBind();
foreach(Control c in Page.Controls)
{
if(c is TextBox)
{
((TextBox)c).Text="";
}
}
}