//------Load Function for the Section Details-----

    public void BindSectionDetailmult(string collegecode)
    {
        try
        {
            int takecount = 0;
            //strbranch = chklstbranch.SelectedValue.ToString();

            chklstsection.Items.Clear();
            ds2.Dispose();
            ds2.Reset();
            ds2 = d2.BindSectionDetailmult(collegecode);
            if (ds2.Tables[0].Rows.Count > 0)
            {
                takecount = ds2.Tables[0].Rows.Count;
                chklstsection.DataSource    = ds2;
                chklstsection.DataTextField = "sections";
                chklstsection.DataBind();
                chklstsection.Items.Insert(takecount, "Empty");
                if (Convert.ToString(ds2.Tables[0].Columns["sections"]) == string.Empty)
                {
                    chklstsection.Enabled = false;
                }
                else
                {
                    chklstsection.Enabled       = true;
                    chklstsection.SelectedIndex = chklstsection.Items.Count - 2;
                    for (int i = 0; i < chklstsection.Items.Count; i++)
                    {
                        chklstsection.Items[i].Selected = true;
                        if (chklstsection.Items[i].Selected == true)
                        {
                            count3 += 1;
                        }
                        if (chklstsection.Items.Count == count3)
                        {
                            chksection.Checked = true;
                        }
                    }
                }
            }
            else
            {
                chklstsection.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            errmsg.Text = "Please Choose Section";
            //  errmsg.Visible = true;
        }
    }
Exemple #2
0
 public void bindsec()
 {
     try
     {
         cbl_sect.Items.Clear();
         txt_sect.Text   = "---Select---";
         cb_sect.Checked = false;
         string build = "";
         build = getCblSelectedValue(cbl_sem);
         string clgvalue = ddlcollegename.SelectedItem.Value.ToString();
         if (build != "")
         {
             ds = d2.BindSectionDetailmult(clgvalue);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbl_sect.DataSource     = ds;
                 cbl_sect.DataTextField  = "sections";
                 cbl_sect.DataValueField = "sections";
                 cbl_sect.DataBind();
                 if (cbl_sect.Items.Count > 0)
                 {
                     for (int row = 0; row < cbl_sect.Items.Count; row++)
                     {
                         cbl_sect.Items[row].Selected = true;
                     }
                     txt_sect.Text   = "Section(" + cbl_sect.Items.Count + ")";
                     cb_sect.Checked = true;
                 }
             }
         }
         else
         {
             cb_sect.Checked = false;
             txt_sect.Text   = "--Select--";
         }
     }
     catch (Exception ex) { }
 }