/// <summary>
    /// 绑定CheckBoxGroup绑定(来源表FW_COMPANY) (2014-09-24)
    /// </summary>
    /// <param name="chk">数据源控件</param>
    public static void ChkGroupBind(CheckboxGroup chk)
    {
        DataTable dsCheckBoxGroup = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_BasicData_FW_COMPANY_BindCheck_SP").GetTable();

        if (dsCheckBoxGroup != null && dsCheckBoxGroup.Rows.Count > 0)
        {
            foreach (DataRow dr in dsCheckBoxGroup.Rows)
            {
                chk.Items.Add(new Checkbox()
                {
                    Value = dr[1].ToString(), Tag = dr[1].ToString().Trim(), BoxLabel = dr[0].ToString(), LabelAlign = LabelAlign.Right, LabelWidth = 45, Checked = true
                });
            }
        }
        else
        {
            chk.Items.Add(new Checkbox());
            chk.Hide();

            //chk.Dispose();
            //chk.Destroy();
        }

        string dept = FSecurityHelper.CurrentUserDataGET()[28].ToUpper();

        if (dept == "OP" || dept == "ACCOUNT")
        {
            chk.Hide();
        }
    }
Exemple #2
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();
        }
    }