Hi, I'm using vs2012.
I used the code form msdn, http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowediting%28v=vs.110%29.aspx
However, I'm getting out range error in run time. Attached is my code snipet. The error happens at
"var sam = ((TextBox)(editRow.Cells[1
I think that the code is taking the row that is being edited (editRow is correct when I examine the property). Cell 0 I think is the Edit button on my grid, it shows as the first column. So cells is the column that I want. Examine the property of Cells show it has count of 6 and that is correct, 1st one is the Edit button generated by gridview control however, the error is with Controls being out of range.
In the aspx file, the 1st cell is a boundfield, code as below
<asp:BoundField DataField ="sAMAccountName" HeaderText="User ID" ReadOnly="True" HeaderStyle-HorizontalAlig
Appreciate help here to fix the problem. Thank you.
I add editRow.Cells to the Watch and there is a cells object. But I don't know how to expand to see where is the Controls because that's where I get the error. I'm attaching the screen shot for this too.
further examination by adding to the Watch panel, I found the error is caused because Cells.Controlls.count is 0. I'm also attaching a screen shot for this. Why is that so? It does display the data that it's bound to. How can I fix this?