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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to get s specific column from a data source

Thread ID:

Created:

Updated:

Platform:

Replies:

52883 Dec 5,2006 06:04 PM UTC Dec 7,2006 02:38 PM UTC WinForms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 5, 2006 06:04 PM UTC

Hi there,
How do I get a specific column from a table in a bound data source?

DataSet ds;
...

this.ds.Table["myTable"]....?????

grid.DataSource = [just the column I want];

Thanks
Dimitri

Administrator [Syncfusion]
Replied On December 5, 2006 06:48 PM UTC

I should add that my data is coming from XML...

myDataSource.ReadXML("file");


>Hi there,
How do I get a specific column from a table in a bound data source?

DataSet ds;
...

this.ds.Table["myTable"]....?????

grid.DataSource = [just the column I want];

Thanks
Dimitri

Administrator [Syncfusion]
Replied On December 5, 2006 07:44 PM UTC

Any help on this would be great, thanks.

>I should add that my data is coming from XML...

myDataSource.ReadXML("file");


>Hi there,
How do I get a specific column from a table in a bound data source?

DataSet ds;
...

this.ds.Table["myTable"]....?????

grid.DataSource = [just the column I want];

Thanks
Dimitri

Administrator [Syncfusion]
Replied On December 6, 2006 04:35 AM UTC

Hi Dimitri,

Use the GridBoundColumns property to manages the bound columns in a GridDataBoundGrid. Here is a code snippet.

//Clear the All columns bound to grid...
this.gridDataBoundGrid1.GridBoundColumns.Clear();

//Add the new column to display in a grid.
GridBoundColumn EmpName = new GridBoundColumn();
EmpName.MappingName = "ColumnName";
this.gridDataBoundGrid1.GridBoundColumns.Add(EmpName);

this.gridDataBoundGrid1.DataSource = ds.Tables[0];

Here is a sample.
GDBGSingleColumn.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On December 6, 2006 05:34 PM UTC

Thank you Haneef - that works, except that it doesn't let me load combo box cells from yet another DataSource. How can I do that?

Administrator [Syncfusion]
Replied On December 7, 2006 04:33 AM UTC

Hi Dimitri,

Try setting the StyleInfo.CellType property of the BoundColumn to "ComboBox" in a grid. Here is a code snippet.

GridBoundColumn EmpName = new GridBoundColumn();
EmpName.MappingName = "EmpName";
EmpName.HeaderText = "EmployeeName";
EmpName.StyleInfo.DataSource = GetComboTable();

//For setting the Combobox column with datasource as Datatable.
EmpName.StyleInfo.CellType = "ComboBox";
EmpName.StyleInfo.ValueMember = "ComboEmpName";
EmpName.StyleInfo.DisplayMember = "ComboEmpName";

this.gridDataBoundGrid1.GridBoundColumns.Add(EmpName);

Here is a modified sample.
GDBGModifiedsample.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On December 7, 2006 02:38 PM UTC

Thanks!
I will take a look.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;