Re: DataGrid Edit Problem - No value access?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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

.



Relevant Pages

  • Cant get text of e.Item.Cells(x)
    ... I cannot grab the text of a datagrid row's cell. ... Dim TestStockNumber As String = CellControl.NavigateUrl ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Changing datagrid cell format
    ... The data are not immediately updated in the database upon the user ... cell, the data in the changed cell are drawn in boldface. ... "Sara S" wrote in message ... >>> Yes, I was talking about the datagrid, but my question is, what event ...
    (microsoft.public.dotnet.framework)
  • RE: Works with table but not SP.
    ... when the datagrid first appears the focus is on the first cell, ... if the user arrows down the cell below is then selected. ... presses the ENTER key the values from the selected row are stored in an array. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Headings in the DataGrid Web Control
    ... DataSet dsTemp = new DataSet; ... >> have a look at the columnspan property of the cell, ... > FROM EmployeeLegacy l, EmployeeCurrent c ... would it be possible to render it in the DataGrid ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Headings in the DataGrid Web Control
    ... DataSet dsTemp = new DataSet; ... >> have a look at the columnspan property of the cell, ... > FROM EmployeeLegacy l, EmployeeCurrent c ... would it be possible to render it in the DataGrid ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)