Hello,
I am binding to an arraylist which contains object items with properties 'name' and 'val', when I call DataBind, ComboBo items are successfully created, but I'am unable to select one of the items.
It's so trivial that I'm thinking I have an error somewhere else, here is my code:
It runs in the Page_Load event of my page, not other interaction after.
The radCombo is not ajaxified, no autopostback.
| ArrayList ar = im.CategoryList; |
| RadComboCat.DataSource = ar; |
| RadComboCat.DataValueField = "val"; |
| RadComboCat.DataTextField = "name"; |
| RadComboCat.DataBind(); |
| if ( catId == 0 ) |
| { |
| RadComboCat.SelectedIndex = 0; |
| } |
| else |
| { |
| string strCat = catId.ToString(); |
| Trace2.WriteLine( string.Format("[V]CRMImageEdit FillCatComboSelected FindItemByValue: [{0}], catId:{1}",strCat,catId),CrmImageTrace.Sw.Info); |
| RadComboBoxItem it = RadComboCat.Items.FindItemByValue(strCat); |
| Trace2.WriteLine( string.Format("[V]CRMImageEdit FillCatComboSelected FindItemByValue found : {0}", it != null ),CrmImageTrace.Sw.Info); |
| if (it != null) |
| { |
| it.Selected = true; |
| Trace2.WriteLine( string.Format("[V]CRMImageEdit FillCatCombo Selected Item: {0}, catId:{1}",it.Text,catId),CrmImageTrace.Sw.Info); |
| } |
| } |
Trace shows that the it.Selected= true instruction is executed, but when page is displayed, nothing is selected.
When I select from the UI, the value is well selected and I can store it ????
What could be the reason ?
(Hollidays I know....)
Thanks
CS