Re: DataGrid Edit Problem - No value access?
- From: "chanko" <chanko@xxxxxxxxx>
- Date: 3 Apr 2007 11:02:45 -0700
On Apr 3, 10:39 am, "_MC_" <mc@localhost> wrote:
Hi,
I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1
Cell. So here it is:
The Datagrid is binded in PageLoad, AutoGenerateColumns is false, Columns
are added on PageLoad like this:
BoundColumn Bound_Column = new BoundColumn();
Bound_Column.DataField = name; ( + HeaderText,
SortExpression, Visible)
DataGrid1.Columns.Add(Bound_Column);
DataGrid has all values. Then user edits one Row and clicks on 'Update'.
Eventhandler for Update is called. Now here is my real problem, i could not
access any row. Datagrid tells me that it as 15 Items (Page), but only 1
Cell (Edit Cell i think). I tried to access datarow via:
for (int i = 1; i < 15; i++) // We have 15 Rows... E. g. (as
e.Utem.Cells.Count is 1)
String columnContent = ((TextBox)e.Item.Cells[i].Controls[0]).Text;
This leads to an Out of Range Exceptions, as Datagrid has only How can i
access the value of the current row?
Thanks for your help,
_MC_
are you using a master page?
if so are you giving your master page an id?
i had a similar problem where i was losing the values of datakeys
within a gridview (on top of another weird treeview error)
and after many attempts at fixing it, i don't know why but i removed
the id i was assigning the master page and it worked. i placed the id
once again just to make sure and had the same error.
don't know what's causing it really but at least that solved my
problems
hope it helps
.
- Follow-Ups:
- Re: DataGrid Edit Problem - No value access?
- From: _MC_
- Re: DataGrid Edit Problem - No value access?
- References:
- DataGrid Edit Problem - No value access?
- From: _MC_
- DataGrid Edit Problem - No value access?
- Prev by Date: Re: problem setting a new membershipProvider in web.config
- Next by Date: Re: Session variable value resets
- Previous by thread: Re: DataGrid Edit Problem - No value access?
- Next by thread: Re: DataGrid Edit Problem - No value access?
- Index(es):
Relevant Pages
|