Exemple #1
0
    //公用方法 绑定CheckboxGroup 站,系统,控件ID
    public void BindCheckboxGroup(string Stat, string Sys, CheckboxGroup chkGroup)
    {
        DataTable dt = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_PRINTERCopy_SP", new List <IFields>()
        {
            dal.CreateIFields().Append("Option", "BindCheck")
            .Append("Stat", Stat)
            .Append("Sys", Sys)
        }).GetTable();

        if (dt != null && dt.Rows.Count > 0)
        {
            int  i    = 0;
            bool isCH = false;
            foreach (DataRow dr in dt.Rows)
            {
                i++;
                if (dr[2].ToString().ToUpper() == "TRUE")
                {
                    isCH = true;
                }
                else
                {
                    isCH = false;
                }

                chkGroup.Items.Add(new Checkbox()
                {
                    Value      = dr[1].ToString(),
                    Tag        = dr[1].ToString().Trim(),
                    BoxLabel   = dr[0].ToString(),
                    LabelAlign = LabelAlign.Right,
                    LabelWidth = 95,
                    Checked    = isCH
                });
            }

            //X.AddScript("$('#" + chkGroup.ID + " input[type=\"checkbox\"]').click(function () {alert(1)});");
            //X.AddScript("alert($('#" + chkGroup.ID + " input[type=\"checkbox\"]').html());");
        }
        else
        {
            chkGroup.Items.Add(new Checkbox());
            chkGroup.Hide();
            chkGroup.Dispose();
            chkGroup.Destroy();
        }
    }