public void bindsec()
    {
        try
        {
            //ddl_sec.Items.Clear();
            cbl_sec.Items.Clear();
            cb_sec.Checked = true;
            txt_sec.Text   = "Section";

            ListItem item = new ListItem("Empty", " ");

            string batch = "";
            batch = ddl_batch.Items.Count > 0 ? ddl_batch.SelectedValue : "0";
            string branch = "";
            branch = reUse.GetSelectedItemsValue(cbl_branch);//ddl_branch.Items.Count > 0 ? ddl_branch.SelectedValue : "0";
            DataSet dsSec = DA.BindSectionDetail(batch, branch);
            if (dsSec.Tables.Count > 0 && dsSec.Tables[0].Rows.Count > 0)
            {
                //ddl_sec.DataSource = dsSec;
                //ddl_sec.DataTextField = "sections";
                //ddl_sec.DataValueField = "sections";
                //ddl_sec.DataBind();

                cbl_sec.DataSource     = dsSec;
                cbl_sec.DataTextField  = "sections";
                cbl_sec.DataValueField = "sections";
                cbl_sec.DataBind();
                reUse.CallCheckBoxChangedEvent(cbl_sec, cb_sec, txt_sec, "Section");
            }
        }
        catch (Exception ex) { }
    }
示例#2
0
 public void bindsec()
 {
     try
     {
         cbl_sec.Items.Clear();
         txt_sec.Text   = "---Select---";
         cb_sec.Checked = false;
         string batch       = rs.GetSelectedItemsValueAsString(cbl_batch);
         string branchcode1 = rs.GetSelectedItemsValueAsString(cbl_branch);
         if (batch != "" && branchcode1 != "")
         {
             ds = d2.BindSectionDetail("'" + batch + "'", "'" + branchcode1 + "'");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 cbl_sec.DataSource     = ds;
                 cbl_sec.DataTextField  = "sections";
                 cbl_sec.DataValueField = "sections";
                 cbl_sec.DataBind();
                 if (cbl_sec.Items.Count > 0)
                 {
                     for (int row = 0; row < cbl_sec.Items.Count; row++)
                     {
                         cbl_sec.Items[row].Selected = true;
                         cb_sec.Checked = true;
                     }
                     txt_sec.Text = "Section(" + cbl_sec.Items.Count + ")";
                 }
             }
             else
             {
                 cbl_sec.Items.Add("Empty");
                 for (int row = 0; row < cbl_sec.Items.Count; row++)
                 {
                     cbl_sec.Items[row].Selected = true;
                     cb_sec.Checked = true;
                 }
                 txt_sec.Text = "Section(" + cbl_sec.Items.Count + ")";
             }
         }
         else
         {
             cbl_sec.Items.Add("Empty");
             for (int row = 0; row < cbl_sec.Items.Count; row++)
             {
                 cbl_sec.Items[row].Selected = true;
                 cb_sec.Checked = true;
             }
             txt_sec.Text = "Section(" + cbl_sec.Items.Count + ")";
         }
     }
     catch (Exception ex)
     {
     }
 }
 public void BindSectionDetail(string strbatch, string strbranch)
 {
     try
     {
         strbatch  = ddlbatch.SelectedValue.ToString();
         strbranch = ddlbranch.SelectedValue.ToString();
         ddlsection.Items.Clear();
         ds2.Dispose();
         ds2.Reset();
         ds2 = d2.BindSectionDetail(strbatch, strbranch);
         if (ds2.Tables[0].Rows.Count > 0)
         {
             ddlsection.DataSource    = ds2;
             ddlsection.DataTextField = "sections";
             ddlsection.DataBind();
             ddlsection.Items.Insert(0, "All");
             if (Convert.ToString(ds2.Tables[0].Columns["sections"]) == string.Empty)
             {
                 ddlsection.Enabled = false;
                 BindSubjecttest(strbatch, strbranch, strsem, strsec);
                 Bindtest();
             }
             else
             {
                 ddlsection.Enabled = true;
                 BindSubjecttest(strbatch, strbranch, strsem, strsec);
                 Bindtest();
                 //    Bindtest(strbatch, strbranch, strsem, strsec1);
             }
         }
         else
         {
             ddlsection.Enabled = false;
         }
     }
     catch (Exception ex)
     {
     }
 }
 public void bindsection()
 {
     try
     {
         ddlsec.Items.Clear();
         ds.Clear();
         ds = d2.BindSectionDetail(ddlbatch.SelectedItem.Text, ddlbranch.SelectedItem.Value);
         if (ds.Tables[0].Rows.Count > 0)
         {
             ddlsec.DataSource     = ds;
             ddlsec.DataTextField  = "sections";
             ddlsec.DataValueField = "sections";
             ddlsec.DataBind();
             ddlsec.Enabled = true;
         }
         else
         {
             ddlsec.Enabled = false;
         }
     }
     catch
     {
     }
 }
    // section laod function

    public void BindSectransport(string strbatch, string strbranch)
    {
        try
        {
            for (int i = 0; i < chklsbatch.Items.Count; i++)
            {
                if (chklsbatch.Items[i].Selected == true)
                {
                    if (strbatch == "")
                    {
                        strbatch = "'" + chklsbatch.Items[i].Value.ToString() + "'";
                    }
                    else
                    {
                        strbatch = strbatch + "," + "'" + chklsbatch.Items[i].Value.ToString() + "'";
                    }
                }
            }

            for (int i = 0; i < chklstbranch.Items.Count; i++)
            {
                if (chklstbranch.Items[i].Selected == true)
                {
                    if (strbranch == "")
                    {
                        strbranch = "'" + chklstbranch.Items[i].Value.ToString() + "'";
                    }
                    else
                    {
                        strbranch = strbranch + "," + "'" + chklstbranch.Items[i].Value.ToString() + "'";
                    }
                }
            }
            //strbranch = chklstbranch.SelectedValue.ToString();

            chklssec.Items.Clear();
            ds2.Dispose();
            ds2.Reset();
            ds2 = d2.BindSectionDetail(strbatch, strbranch);
            if (ds2.Tables[0].Rows.Count > 0)
            {
                chklssec.DataSource    = ds2;
                chklssec.DataTextField = "sections";
                chklssec.DataBind();
                //chklstsection.Items.Insert(0, "All");
                if (Convert.ToString(ds2.Tables[0].Columns["sections"]) == string.Empty)
                {
                    chklssec.Enabled = false;
                }
                else
                {
                    chklssec.Enabled           = true;
                    chklssec.SelectedIndex     = chklssec.Items.Count - 2;
                    chklssec.Items[0].Selected = true;
                    for (int i = 0; i < chklssec.Items.Count; i++)
                    {
                        chklssec.Items[i].Selected = true;
                        if (chklssec.Items[i].Selected == true)
                        {
                            count3 += 1;
                        }
                        if (chklssec.Items.Count == count3)
                        {
                            chksec.Checked = true;
                        }
                    }
                }
            }
            else
            {
                chklssec.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            errmsg.Text = " Please Select the Branch";
        }
    }