Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid - Unable to update with dynamic BoundColumns

Thread Tools

DataGrid - Unable to update with dynamic BoundColumns

Posts: n/a
Hi everybody,

A very strange problem with WebControls :

A Datagrid in an application;
Bound with a dataset through;
The updatable columns are dynamically created;
When I try to update my DataGrid, I access the cols by means of
e.Item.Cells.Count (OnUpdate event)
and there :
e.Item.Cells.Count is equals to 1 (only the static column is seen) !!

tech info :
- W2K workstation sp3
- Version Microsoft .NET Framework :1.1.4322.573; Version ASP.NET

I'm stuck with this for 2 days, and so desperate...
Any idea ?
Thanks in advance for replying.

Jean-Louis PAUL


The BoundColumns are created with :

// objDSet : a dataset previously obtained
foreach (DataColumn dc in objDSet.Tables[0].Columns)
BoundColumn bc = new BoundColumn();
bc.HeaderText = dc.ColumnName;
bc.DataField = dc.ColumnName;
this.DataGrid1.Columns.AddAt(1 + dc.Ordinal, bc);
this.DataGrid1.DataSource = objDSet;

Then, I try to access the modified values with :

private void OnUpdate(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
// !! Note : While I have 2 BoundColumns, numCols=1 (only the static
colmun is seen) !!
int numCols = e.Item.Cells.Count;

for (int i=1; i<numCols; i++)
String colvalue =((TextBox)e.Item.Cells[i].Controls[0]).Text;

When I created the BoundColumns with the property page, it's OK for
================================================== ========================

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid Item Command Event and BoundColumns New Bee ASP .Net 0 09-07-2007 01:30 PM
DataGrid BoundColumns and ViewState - A Question New Bee ASP .Net 1 09-06-2007 07:48 PM
Problem Soring DataGrid using BoundColumns =?Utf-8?B?Y2hhcmxpZXdlc3Q=?= ASP .Net 0 03-31-2005 09:17 AM
Format Data in BoundColumns of DataGrid ruca ASP .Net Web Controls 10 02-23-2004 11:47 AM
Format Data in BoundColumns of DataGrid ruca ASP .Net 10 02-23-2004 11:47 AM