tags:

views:

13

answers:

1

Hi all i have a datagrid which has 10 rows in each row there is text box i want to fill that txtbox from database. text box is inside the grid..so can some one help he how to fill that text box

A: 
foreach(DataGridItem dgi in myDataGrid.Items)
{
  TextBox myTextBox = (TextBox) (dgi.Cells[0].FindControl("Your_Textbox_ID"));
  myTextBox.Text = "Custom Text";
}

OR:

foreach(DataGridItem dgi in myDataGrid.Items)  
{  
  TextBox myTextBox = (TextBox) (dgi.Cells[0].Controls[Your_TextBox_Column_Index]);  
  myTextBox.Text = "Custom Text";  
}  
Kamyar