I have an ascx page that has a couple of RadComboBox controls. Those comboboxes have a RadTreeView template populated with some values. When the user clicks on the nodes the combobox's text changes. This all works pretty well. My problem however is that when the user submits the form, and he missed one or more fields, the checked nodes remain checked (which is a good thing) but the text in the combobox gets cleared again. I need to fire an onload event in which I can run through the treeviews and set the text of the comboboxes.
The code that I use to try to get this effect:
However, I get the error in the load() function that all the comboboxes return 'null'.
The code that I use to try to get this effect:
| function addEvent(evnt, elem, func) |
| { |
| if (elem.addEventListener) // W3C DOM |
| elem.addEventListener(evnt,func,false); |
| else if (elem.attachEvent) // IE DOM |
| { |
| var r = elem.attachEvent("on"+evnt, func); |
| } |
| return r; |
| } |
| addEvent(window.onload,load()); |
| function load() |
| { |
| var comboClass = $find("<%= rcClass.ClientID %>"); |
| var comboCountry = $find("<%= rcCountry.ClientID %>"); |
| var comboTm = $find("<%= rcTrademark.ClientID %>"); |
| var comboYearFrom = $find("<%= rcYearFrom.ClientID %>"); |
| var comboYearTo = $find("<%= rcYearTo.ClientID %>"); |
| var comboType = $find("<%= rcType.ClientID %>"); |
| var treeClass = comboClass.get_items().getItem(0).findControl("TreeClass"); |
| var treeCountry = comboCountry.get_items().getItem(0).findControl("TreeCountry"); |
| var treeYearTo = comboYearTo.get_items().getItem(0).findControl("TreeYearTo"); |
| var treeYearFrom = comboYearFrom.get_items().getItem(0).findControl("TreeYearFrom"); |
| var treeTrademark = comboTm.get_items().getItem(0).findControl("TreeTrademark"); |
| setText(comboClass,treeClass,0); |
| setText(comboCountry,treeCountry,2); |
| setText(comboTm,treeTrademark,1); |
| setYear(comboYearFrom); |
| setYear(comboYearTo); |
| } |
However, I get the error in the load() function that all the comboboxes return 'null'.