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.

DataGrid and hide column

Thread ID:




4373 May 9,2003 02:23 AM Windows Forms 0
Tags: FAQ
vinh tran
Asked On May 9, 2003 02:23 AM

Hi, I've tried the code in the FAQ How to Hide a Column http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q708q you gave with GridColumnStyles to the Datagrid's TableStyles. class MyClass { ... ArrayList myList; ... public void AddObj(Obj o) { this.myList.Add(o); } } ... class Obj { string Name1; ..... string NameX; } I'd like to display in a datagrid just Name1 or Name2 for example. I've tried a "normal" table (DataTable) and there is no problem , but for my ArrayList of objects, an ArgumentOutOfRangeException is called : the mapping is not done. Here is my code : dataGrid1.DataSource = myClass.myList; // DataGrid settings DataGridTableStyle dgts = new DataGridTableStyle(); dgts.MappingName = "myClass.myList"; dataGrid1.TableStyles.Add(dgts); dgts.GridColumnStyles[2].Width=0; dgts.DataGrid.Refresh(); Where is the error ? Thanks vinh


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.