can we directly assign a value to row in the gridview
-
can we directly assign a value to a particular cell of row in the gridview. using the select statement select 'flavia' as name, 'A'as surname i bound the data to the gridview.. but on the selected Index changed of the grid view i want the data to be displayed in the text boxes ..which i managed using the gridview1.SelectedRow.cells[1].text= txtName.text; but after modifying the textbox txtName for (i = 0; i < GridView3.Rows.Count; i++) { string b if (GridView3.Rows[i].Cells[1].Text.ToString()== s) { GridView1.Rows[i].Cells[1].Text = txtName.Text; } } but it is giving an exception {System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}
-
can we directly assign a value to a particular cell of row in the gridview. using the select statement select 'flavia' as name, 'A'as surname i bound the data to the gridview.. but on the selected Index changed of the grid view i want the data to be displayed in the text boxes ..which i managed using the gridview1.SelectedRow.cells[1].text= txtName.text; but after modifying the textbox txtName for (i = 0; i < GridView3.Rows.Count; i++) { string b if (GridView3.Rows[i].Cells[1].Text.ToString()== s) { GridView1.Rows[i].Cells[1].Text = txtName.Text; } } but it is giving an exception {System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}
Flavia A wrote:
{System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}
Do you know how to use the debugger ? Do you have any understanding of English ? Obviously one of your rows does not have 2 cells in it, for some reason. That's a guess, if you used the debugger, you should be able to work it out AND tell us what line blows up if you need to.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.