DataGrid

  • Thread starter Serdar Kalaycý
  • 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

--
 
M

MeeraDevi Karthikeyan

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;
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top