DataGrid

  • Thread starter Thread starter Serdar Kalaycý
  • Start date Start date
S

Serdar Kalaycý

I have a DataGrid, which I created two template columns, and I added
TextBoxes to their Footers to allow the user add a new record to the
database. I cannot access TextBoxs' values in the code. What can I do?

Thanks
Serdar KALAYCI

--
 
You should write something like this:

private void btnSave_OnClick(object sender, EventArgs e)
{
foreach(DataGridItem item in grdUsers.Items)
{
if(item.ItemType == ListItemType.Item ||
item.ItemType == ListItemType.AlternatingItem)
{
TextBox txtFirstName, txtLastName;
txtFirstName = item.FindControl
("txtFirstName") as TextBox;
txtLastName = item.FindControl
("txtLastName") as TextBox;
}
}
}
 
Back
Top