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.
Unfortunately, activation email could not send to your email. Please try again.

how to get s specific column from a data source

Thread ID:

Created:

Updated:

Platform:

Replies:

52883 Dec 5,2006 01:04 PM Dec 7,2006 09:38 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 5, 2006 01:04 PM

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 01:48 PM

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 02:44 PM

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 5, 2006 11:35 PM

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 12:34 PM

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 6, 2006 11:33 PM

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 09:38 AM

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.

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.

;