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

How to bind data to gridcontrol from database through code?

hi there, i already tried it some how, but it is not getting i paste my code check it

gridControl1.TableStyle.DataSource=dataTable;

i written like that, But i am not getting.

6 Replies

MS Maniratheenam Sehar Syncfusion Team April 22, 2014 07:17 AM UTC

Hi Venkata,

Thank you for your interest in Syncfusion product.

 In GridControl, we can’t able to bind the database directly to it. Instead, as a suggestion, you can make use of GridGroupingControl to bind the data source. But, if you still need to use GridControl, you can populate the values from the datasource. We have added a sample to understand how you can easily bind data to GridControl.

CodeSnippet[C#]:

            this.gridControl1.RowCount = table.Rows.Count;

            this.gridControl1.ColCount = table.Columns.Count;

            this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), table);

by using PopulateValues() you can bind the data into GridControl by providing Rowcount and ColCount values of the table(here datasource is a “table”).

 

Please let me know if you have any concerns.          

 Regards,

ManiRatheenam S


Attachment: WindowsFormsApplication11_5facbca3.zip


VE Venkata April 24, 2014 01:14 PM UTC

Hi Maniratheenam Sehar,
Thanks for your response. i have another doubt in Grid data Bound Grid can we do row wise operations. I am attaching a Application, Please check it, it will help us for better understanding my problem. I want those row wise operation in syncfusion GridDataBoundGrid  Control.

Regards
Venkata

Attachment: RowWiseOperation_30963d86.rar


MS Maniratheenam Sehar Syncfusion Team April 25, 2014 11:33 AM UTC

Hi Venkata,

We would like you to Know about  that the GridDataBoundGrid Control can also perform RowWise Operation. Here, by using CurrentCellShowedDropDown’ event in  GridDataBoundGrid Control which behaves same as ‘CellEnter’ event  which you have used in DataGridView Control, you can perform rowwise operation. We have added a sample below for your better convenience.

Please let us know if you have any further assistance. 

Regards,

ManiRatheenam S


Attachment: WindowsFormsApplication13_a1003b8a.zip


VE Venkata April 25, 2014 04:37 PM UTC

Hi ManiRatheenam S,
It works fine, thanks for your response.

Regards
Venkata


VE Venkata April 29, 2014 04:29 PM UTC

Hi Maniratheenam,

Can you tell me what is the alternate for RowValidating Event in syncfusion GridDataBoundGrid.


SA Solai A L Syncfusion Team May 10, 2014 07:42 AM UTC

Hi Venkata,

Thanks for the update.

We hope you got a solution for this query from your previous forum(116224) update. Please let us know if you have any other concerns.

Thanks & Regards,

AL.Solai.


Loader.
Live Chat Icon For mobile
Up arrow icon