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.
Syncfusion Feedback

Mapping a GridBoundColumn to the underlying DataColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

8257 Oct 29,2003 07:25 PM UTC Oct 30,2003 03:19 PM UTC Windows Forms 3
loading
Tags: GridControl
Doug Lind
Asked On October 29, 2003 07:25 PM UTC

Hi, I need to evaluate the source DataColumn datatype for some GridBoundColumns in a GridBoundColumnsCollection. Is there a way to get to the source DataColumn using a GridBoundColumn or its index within the GridBoundColumnsCollection? Thanks, Doug Lind

Administrator [Syncfusion]
Replied On October 29, 2003 07:52 PM UTC

GridBoundColumn.MappingName holds the name of the DataColumn. //get the datacolumn for the 3rd col in grid string dataTableColumnName = this.gridDataBoundGrid1.GridBoundColumns[2].MappingName; DataColumn dc = this.dataTable1.Columns[dataTableColumnName];

Doug Lind
Replied On October 30, 2003 12:24 PM UTC

Thanks for the response Clay. I was hoping to avoid having to evaluate the DataSource type (DataSet, DataTable, etc), to extract the underlying "table". In a reponse to one of my previous questions, you steered me towards using the CurrencyManager to extract the underlying DataRow based upon the grid row index. Is there some method like this for retrieving a DataColumn based upon the grid column index? Doug > GridBoundColumn.MappingName holds the name of the DataColumn. > > > //get the datacolumn for the 3rd col in grid > string dataTableColumnName = this.gridDataBoundGrid1.GridBoundColumns[2].MappingName; > DataColumn dc = this.dataTable1.Columns[dataTableColumnName];

Administrator [Syncfusion]
Replied On October 30, 2003 03:19 PM UTC

There is a PropertyDescriptor property you can use, it it can only returns values not a whole column. //the value from the 5 item in the 3rd column. int item = 5; CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember]; object o = cm.List[item]; PropertyDescriptor pd = this.gridDataBoundGrid1.Binder.InternalColumns[2].PropertyDescriptor; object val = pd.GetValue(o); Console.WriteLine(val);

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

;