The ComboBox of Componentart Control Analysis (2)

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.