Ask a Question related to ASP.NET General, Design and Development.
-
Funbeat #1
DataGrid - Unable to update with dynamic BoundColumns
Hi everybody,
A very strange problem with WebControls :
A Datagrid in an ASp.net application;
Bound with a dataset through ado.net;
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
:1.1.4322.573
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.Initialize();
bc.HeaderText = dc.ColumnName;
bc.DataField = dc.ColumnName;
this.DataGrid1.Columns.AddAt(1 + dc.Ordinal, bc);
}
this.DataGrid1.DataSource = objDSet;
this.DataGrid1.DataBind();
....
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
reading
================================================== ========================
???
Funbeat Guest
-
Postbacks removing DataGrid which has BoundColumns created in code.
I'm having an issue with my DataGrid being removed from the page on postbacks. All of the columns are added programatically as the application... -
update datagrid with dynamic bound column
I have a simple question which is how to get the entered values on update so I can save them to a database? Specifically I call findControl to get... -
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event.
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the... -
Validating Boundcolumns in datagrid
Hi, I have a Datagrid with boundcolumns. I need to validate the textbox when the user clicks the update link.How can i do it. Also i need to set... -
Best Practice - Update Dynamic Datagrid
Hello, I have a database which contains approximately 30 reference tables. I've been looking at building a dynamic datagrid that is updateable,...



Reply With Quote

