DevExpress GridControl Data Binding

When binding a datagrid (GridControl) to a table do the following:
  1. Create a typed dataset class by calling something like    myDs.WriteXmlSchema(“D:\MyDataset.xsd”in a web service web method (assuming the DAL is done on the web service). It will generate and save the schema into the file. Copy the file into the client application project.
  2. Create a dataset component by dragging the created dataset onto the form. This will create global variable of type MyDataset (say, m_MyDataset).
  3. Set your GridControl’s DataSource property to m_MyDataset.MY_TABLE_1 and leave DataMember property empty (as opposed to setting DataSource to m_MyDataset and DataMember to MY_TABLE_1).
    NOTE: it is not possible to do this step in VS designer. You will need to manually modify MyForm.Designer.vb file.
  4. If you have another grid control which should display child records, set its DataSource property to the same value (m_MyDataset.MY_TABLE_1) but also specify the relation name in the DataMember property.
WARNING: GetChildRows() method of DataRow class unexpectedly ignores trailing spaces in columns which participate in the relation. The logic behind GridControls does not ignore the spaces. This behaviour may result in situation when GetChildRows() returns an array of child rows which is larger than the number of rows displayed in the child GridControl.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: