A. Look at the data data analysis
First, Mr. Backstage into a data format, which is similar to JSON (I don't know why we don't use JSON) to view the HTML source code
Combobox2.data = [[[' Text ', ' a '],[' Value ', ' B ']],[[' Text ', ' B '],[' Value ', ' C ']],[[' text ', ' C '],[' Enabled ', 0],[' value ' , ' B ']],[[' CssClass ', ' comboitemhover '],[' text ', ' d '],[' Value ', ' C '],[' Id ', ' ComboBoxItem1 ']],[[' text ', ' a '],[' Value ', ' B ']],[[' text ', ' B '],[' value ', ' C ']],[[' Text ', ' C '],[' Enabled ', 0],[' value ', ' B ']],[[' CssClass ', ' Comboitemhover '],[' text ', ' d '],[' value ', ' C '],[' Id ', ' ComboBoxItem2 ']],[[' text ', ' A '],[' value ', ' B ']],[[' text ', ' B '] , [' Value ', ' C ']],[[' text ', ' C '],[' Enabled ', 0],[' value ', ' B ']],[[' CssClass ', ' comboitemhover '],[' text ', ' d '],[' Value ', ' C '],[' Id ', ' ComboBoxItem3 ']],[[' text ', ' A '],[' Value ', ' B ']],[[' Text ', ' B '],[' value ', ' C ']],[[' text ', ' C '],[' Enabled ', 0],[' value ', ' B ']],[[' CssClass ', ' comboitemhover '],[' Text ', ' d '],[' value ', ' C '],[' Id ', ' hello ']];
2. Need to define a ComboBoxItem object (naturally to define the type of data collection), which JS also to define, the data structure using Hashtable, find speed. A javascriptarray is defined to transform the data
private string Buildstorage ()
{
Javascriptarray arnodelist = new Javascriptarray ();
foreach (ComboBoxItem oitem in this. Items)
{
Processitem (oitem, arnodelist);
}
string strlist=arnodelist.tostring ();
return strlist;
}
private void Processitem (ComboBoxItem oitem, ArrayList arnodelist)
{
ArrayList itempropertie s = new ArrayList ();
foreach (String propertyname in OItem.Properties.Keys)
{
switch (propertyname.tolower ())
{
Bools case
"enabled": Itemproperties.add (New object[] {"Enabled", oitem.enabled});
Normal string handling
default:
itemproperties.add (new object[] {propertyname, Oitem.propert Ies[propertyname]});
break;
}
Arnodelist.add (itemproperties);
}
3. Processing data at the front desk
The data will be processed later.
The Render method is invoked when the ComboBox (Initialize) of the preceding segment is initialized, and the Render method invokes the Renderdropdown method, Renderdropdown method calls the RenderItem method, and renders each item