Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MmDataGrid
Message
From
03/02/2004 10:09:18
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Miscellaneous
Thread ID:
00872912
Message ID:
00873372
Views:
19
>Steve,
>
>>I've noticed that the mmDataGrid doesn't handle the column collection properly when you have the AutoGenerateColumns set on. Every time I've tried this, I get an Index Out of Range exception. I've also tried adding bound columns to the mmDataGrid at run time and can't seem to get the binding to work properly.
>
>I haven't seen this problem before with the AutoGenerateColumns property. If you drag and drop an mmDataGrid on a form this property is automatically set to true. I'd be curious to see if you drop a new mmDataGrid on your Web Form and simply set the BindingSource type if you still see this error.
>
>Regarding bound columns you have added dynamically at run time, do other design-time columns bind properly? If none of the columns are binding, try calling the MM .NET Web form's BindControl() method.
>
>Regards,

Calling the BindControl() method fixed the problem with the columns added via code.

I left out some important information on the AutoGenerateColumns issue. The error happens when I call the SaveDataSet in the code below.

private void dgStates_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// Get the item to be updated
this.dgStates.EditItemIndex = e.Item.ItemIndex;
// Retrieve the previous States DataSet
DataSet dsStates = (DataSet)Session["dsStates"];
// Save the DataSet (the DataGrid automatically binds back)
this.oStates.SaveDataSet(dsStates);
// Reset the edited item and rebind the DataGrid
this.dgStates.EditItemIndex = -1;
this.BindControl(this.dgStates);
}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform