We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Assign Database in GridControl

Hello,
 
Can you please explain us.. how to assign datatable / dataset into GridControl..?
 
And which grid is more suitable for Data Entry...?
 
Thanks

1 Reply

VK Vinish Kumar K Syncfusion Team February 28, 2013 11:50 AM UTC

Hi Rajnikant,

 

Thank you for your interest in Syncfusion products.

 

Query

Assign Database in GridControl

To access the dataset in Grid, Initially load the dataset to the grid using the following code snippet.

 

//load the dataset

 

this.sqlDataAdapter1.Fill(this.dataSet11);

 

After loading you can retrieve records from the Grid itself. If you are using the VS designer to add your daatset and datatable, if you allow it to generate Update commands, then you only have to call this.sqlDataAdapter1.Update to have the dataadapter move the changes back to the data source. This is analogous to the this.sqlDataAdapter1.Fill command that retrieves the information when the data is originally loaded.

 

If you trying to rebind a datasource, you have to reset the DataSource before rebinding it. You can follow the below code snippets for rebinding a DataSource in GridGroupingControl.

 

Below is the code snippet:

 

 

this.gridGroupingControl1.DataSource = null;

this.gridGroupingControl1.DataMember = null;

this.gridGroupingControl1.ResetTableDescriptor();

this.gridGroupingControl1.TableDescriptor.Relations.Clear();

this.gridGroupingControl1.DataSource = ds.Tables[1];

this.gridGroupingControl1.Reinitialize();

this.gridGroupingControl1.Refresh();

 

please use the above suggestion and let me know if this helps to you. And please provide the any sample and some more details if you need any more information about this. This will helps us to provide quick response,

 

 

 

Warm Regards,

Vinish Kumar K


Loader.
Live Chat Icon For mobile
Up arrow icon