欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[Ext.Net]遍历checkboxGroup

程序员文章站 2023-11-01 18:01:16
[csharp]  前台方法:  var items = Ext.getCmp("CheckboxGroup1").items; ...

[csharp]  前台方法: 
var items = Ext.getCmp("CheckboxGroup1").items; 
 
  for (var i = 0; i < items.length; i++) { 
                    if (items.itemAt(i).checked) { 
                                           } 
                } 
后台方法: 
       Ext.Net.CheckboxGroup mygroup1=new CheckboxGroup();  
        mygroup1 = (Ext.Net.CheckboxGroup)this.form1.FindControl("ItemTypeGroup"); 
        string itemtype = string.Empty; 
        for(int i=0;i<mygroup1.Items.Count;i++) 
        { 
            if (mygroup1.Items[i].Checked)  
            { 
                string tmp; 
                if (mygroup1.Items[i].BoxLabel == "非贸易品") 
                { 
                    tmp = "'" + "N" + "'"; 
                } 
                else  
                { 
                    tmp = "'" + "Y" + "'"; 
                } 
                itemtype = tmp + "," + itemtype; 
            } 
 
        } 
        X.Msg.Alert("xx",itemtype.Substring(0,itemtype.Length-1)).Show(); 

前台方法:
var items = Ext.getCmp("CheckboxGroup1").items;

  for (var i = 0; i < items.length; i++) {
                    if (items.itemAt(i).checked) {
                                           }
                }
后台方法:
       Ext.Net.CheckboxGroup mygroup1=new CheckboxGroup();
        mygroup1 = (Ext.Net.CheckboxGroup)this.form1.FindControl("ItemTypeGroup");
        string itemtype = string.Empty;
        for(int i=0;i<mygroup1.Items.Count;i++)
        {
            if (mygroup1.Items[i].Checked)
            {
                string tmp;
                if (mygroup1.Items[i].BoxLabel == "非贸易品")
                {
                    tmp = "'" + "N" + "'";
                }
                else
                {
                    tmp = "'" + "Y" + "'";
                }
                itemtype = tmp + "," + itemtype;
            }

        }
        X.Msg.Alert("xx",itemtype.Substring(0,itemtype.Length-1)).Show();