Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Del #1
Datagrid e.Item.Cells(1) argument was out of range
I'm creating a dynamic datagrid using Dim objbc As New BoundColumn, etc. The
datagrid is populating correctly. I am also using first column of grid as
'edit', on clicking this the update link is displayed and textboxes are
returned. All good so far.
When I change the values in the text box and click update, I keep getting:
Specified argument was out of the range of valid values. Parameter name: index
for this line
tb = CType(e.Item.Cells(1).Controls(0), TextBox)
I've checked the content of e.item.cells and it is empty, why????
If I create the datagrid and bind it directly to a dataset then everything
works, however I want to create the dataset, etc. completely dynamically.
What am I missing? I've seen much correspondence of others getting the same
issue, but there are no answers. After much searching I did find a post
suggesting that the issue is due to viewstate, and that the binding of the
columns should be done on Page_Init and not Page_Load. Is this the solution
I'm looking for?
Del Guest
-
Simple question: e.Item.Cells(0).Controls*(0)
I am new at this.. probably not proficient enough to even consider myself a Newbie yet. :-) I have a DataGrid with Template columns. After the... -
Can't get text of e.Item.Cells(x)
Hi, I cannot grab the text of a datagrid row's cell. I am trying to access the value in the datagrid's ItemCreated event. I use a conditional... -
e.Item.Cells[] doesn't get the content of the cell i clicked in(sorry this is the full message.
e.item.cells only gets you to the cell, you then need to access the control in the cell and look at the control's text, not the cell's text. It... -
CType(e.Item.Cells(3).Controls(1), textbox) fails when key is set to READONLY
The code could not be simpler: Dim txtProjectID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox) Dim dblProjectID As Double =... -
Blank value returned on ItemDataBound event using e.Item.Cells
Hi, I have a datagrid and want to be able to assess the value of one cell on each line in order to hide or display the hyperlink in the next... -
Del #2
RE: Datagrid e.Item.Cells(1) argument was out of range
Please ignore my question, a colleague has assisted me in solving the
problem. The issue lay around the way I was getting the data and binding it
to the grid.
"Del" wrote:
> I'm creating a dynamic datagrid using Dim objbc As New BoundColumn, etc. The
> datagrid is populating correctly. I am also using first column of grid as
> 'edit', on clicking this the update link is displayed and textboxes are
> returned. All good so far.
>
> When I change the values in the text box and click update, I keep getting:
> Specified argument was out of the range of valid values. Parameter name: index
>
> for this line
> tb = CType(e.Item.Cells(1).Controls(0), TextBox)
>
> I've checked the content of e.item.cells and it is empty, why????
>
> If I create the datagrid and bind it directly to a dataset then everything
> works, however I want to create the dataset, etc. completely dynamically.
> What am I missing? I've seen much correspondence of others getting the same
> issue, but there are no answers. After much searching I did find a post
> suggesting that the issue is due to viewstate, and that the binding of the
> columns should be done on Page_Init and not Page_Load. Is this the solution
> I'm looking for?Del Guest



Reply With Quote

