Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Set header for column in Webcombo
posted

Hi I just new to web , when I try to do something simple like :

- populate the datasource of  Webcombo a list of object

public class vComboObject
        {
           
            private String _colValue;
            private String _colHeader;

            public String colValue
            {
                get { return _colValue; }
                set { _colValue = value; }
            }
            public String colHeader
            {
                get { return _colHeader; }
                set { _colHeader = value; }
            }

      }

void Page_Load(object sender, EventArgs e)
        {

            List <vComboObject> vcombo;

            // some code set data for vcombo here
            MyCombo.Datasource =   vcombo ;    
            MyCombo.DataValueField = "colValue";
            MyCombo.DataTextField = "colHeader";
            MyCombo.DisplayValue = "colHeader";
        }

- The webcombo is display fine but I can't access to its column for example :

+ Can't set header caption by : MyCombo.Columns[0].Header.Caption="My header"; // will throw an error

+ Or set the first column hidden for single column combo: MyCombo.Columns[0].hidden= true;

- At my winform application when populate a wincombo like that I still can do all thing above :

+ Set header : MyCombo.DisplayLayout.Bands[0].Columns[0].Header.Caption ="My header";

+ Hidden column :  MyCombo.DisplayLayout.Bands[0].Columns[0].Hidden=true;

Do I mistake something?

Thanks for read, appreciate any help.