示例#1
0
 public void bindcollege()
 {
     try
     {
         ds.Clear();
         Cbl_college.Items.Clear();
         string clgname = "select cp.college_code,cf.collname from collegeprivilages cp,collinfo cf where user_code=" + Session["usercode"] + " and cp.college_code=cf.college_code";
         ds = d2.select_method_wo_parameter(clgname, "Text");
         if (ds.Tables[0].Rows.Count > 0)
         {
             Cbl_college.DataSource     = ds;
             Cbl_college.DataTextField  = "collname";
             Cbl_college.DataValueField = "college_code";
             Cbl_college.DataBind();
         }
         if (Cbl_college.Items.Count > 0)
         {
             //for (int row = 0; row < Cbl_college.Items.Count; row++)
             //{
             Cbl_college.Items[0].Selected = true;
             Cb_college.Checked            = false;
             //}
             Txt_college.Text = "College(1)";
         }
     }
     catch (Exception ex)
     {
     }
 }
    public void bindclg()
    {
        try
        {
            ds.Clear();
            Cbl_college.Items.Clear();
            string clgname = "select cp.college_code,cf.collname from collegeprivilages cp,collinfo cf where user_code=" + Session["usercode"] + " and cp.college_code=cf.college_code";
            ds = d2.select_method_wo_parameter(clgname, "Text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                Cbl_college.DataSource     = ds;
                Cbl_college.DataTextField  = "collname";
                Cbl_college.DataValueField = "college_code";
                Cbl_college.DataBind();
            }
            if (Cbl_college.Items.Count > 0)
            {
                for (int row = 0; row < Cbl_college.Items.Count; row++)
                {
                    Cbl_college.Items[row].Selected = true;
                    Cb_college.Checked = true;
                }
                Txt_college.Text = "College(" + Cbl_college.Items.Count + ")";

                string college = "";
                for (int row = 0; row < Cbl_college.Items.Count; row++)
                {
                    if (Cbl_college.Items[row].Selected == true)
                    {
                        if (college == "")
                        {
                            college = Cbl_college.Items[row].Value;
                        }
                        else
                        {
                            college = college + "'" + "," + "'" + Cbl_college.Items[row].Value;
                        }
                    }
                }
                clgcode1 = college;
            }

            else
            {
                Txt_college.Text = "--Select--";
            }
        }
        catch (Exception ex)
        {
            d2.sendErrorMail(ex, collegecode1, "Options_Creation");
        }
    }