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.
Just another note, it's happen in 8.3.20083.1009 and in hotfix 8.3.20083.2059 i just try today it is solved
It seem you didn't read all my post. This problem only when I set the combo.datasource with my simple list , and it doesn't happen when I manual add to the combo 2 column and use foreach to add row.
Hi,
I have wrongly that MyCombo.Columns[0].Header.Caption =="My header";
The correct code is MyCombo.Columns[0].Header.Caption ="My header"; and it is working fine for me.
Regards,
Kannan.S
Well, the "==" will error . I don't understand the meaning of the code you give :| .
Btw, i have to manual add the list vComboObject to the combo by add 2 UltraGridColumn to combo and fed the List data by row add. I just wonder why when I set Mycombo.datasource = List, the combo just display fine as I manual add but i can't set header for it.
Use the below code to set the column header text.
MyCombo.Columns[0].Header.Caption =="My header";