Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSet Sort Error
Message
From
04/02/2009 18:03:40
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01378880
Message ID:
01379372
Views:
25
Kevin,

Get rid of setting the grdContacts.DataMember. That's only used if your DataSource is a DataSet, then you'd set the DataMember to the DataTable you want to use. But, since you're setting the DataSource directly to a DataView, you don't need to set the DataMember and as you can see, it does cause problems when you do it. In fact, I never bother with setting a DataMember. The DataSource is always set directly to the DataTable or DataView that I want to display in my Grid.

~~Bonnie




>I have a DataSet bound to a DataGridView. I'm trying to sort the grid:
>
>
>dsContacts = csPIM.oDataAccess.ExecuteStoredProc("pp_GetContacts");
>
>if (sSortColumnName == "")
>{
>    sSortColumnName = dsContacts.Tables[0].Columns[0].ColumnName;
>}
>
>DataView dtView = dsContacts.Tables[0].DefaultView;
>dtView.Sort = sSortColumnName;
>
>grdContacts.DataSource = dtView;
>grdContacts.DataMember = dsContacts.Tables[0].TableName;
>
>
>On the last line I get "Child list for field Table cannot be created."
>
>What am I doing wrong here???
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform