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.

Adding Columns

Thread ID:





27996 Apr 21,2005 07:46 AM Apr 21,2005 08:32 AM Windows Forms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On April 21, 2005 07:46 AM

Hi, I am using DataboundGrid. I added 10 columns using m_ListingTable.Columns.Add(new DataColumn("1")); I want to access same columns using GridBoundColumns How do i do that. It threw exception when i used the below code for (int start = 0; start < m_ListingTable.Columns.Count; start++) { GridBoundColumn column = new GridBoundColumn(); column.MappingName = m_ListingTable.Columns[0].ColumnName.ToString(); column.HeaderText = m_ListingTable.Columns[0].ColumnName.ToString(); if (!m_ListingGrid.GridBoundColumns.Contains(column)) { m_ListingGrid.GridBoundColumns.Add(column); } }

Administrator [Syncfusion]
Replied On April 21, 2005 08:32 AM

Each of the DataColumns needs a different name, so you cannot create all ten using the name "1". In your loop, try using start instead of 0. column.MappingName = m_ListingTable.Columns[start].ColumnName.ToString(); column.HeaderText = m_ListingTable.Columns[start].ColumnName.ToString();


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.