protected void Page_Load(object sender, EventArgs e)
 {
     DivDT = DivAdapter.SelectDiv();
     GridView1.DataSource = DivDT;
     GridView1.DataBind();
     lblstd.Text = GridView1.Rows.Count.ToString();
 }
 protected void drpstd_SelectedIndexChanged(object sender, EventArgs e)
 {
     DivDT                 = DivAdapter.Select_By_STD(drpstd.SelectedItem.Text);
     drpdiv.DataSource     = DivDT;
     drpdiv.DataTextField  = "DivName";
     drpdiv.DataValueField = "DID";
     drpdiv.DataBind();
     drpdiv.Items.Insert(0, "SELECT");
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            StaffDT = StaffAdapter.Select_UNAME(Session["uname"].ToString());

            lblstd.Text = StaffDT.Rows[0]["StdName"].ToString();

            DivDT                 = DivAdapter.Select_By_STD(StaffDT.Rows[0]["StdName"].ToString());
            drpdiv.DataSource     = DivDT;
            drpdiv.DataTextField  = "DivName";
            drpdiv.DataValueField = "DID";
            drpdiv.DataBind();
            drpdiv.Items.Insert(0, "SELECT");
            drpstudent.Items.Insert(0, "SELECT");
        }
    }
    protected void btnstuadd_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("~/Studentimg/" + FileUpload1.FileName));
            DateTime bdate = Convert.ToDateTime(drpdd.SelectedItem.Text + " " + drpmm.SelectedItem.Text + " " + drpyyyy.SelectedItem.Text);

            StuAdapter.Insert(txtroll.Text, txtname.Text, lblstd.Text, drpdiv.SelectedItem.Text, txtemail.Text, txtmobi.Text, bdate.GetDateTimeFormats()[8].ToString(), "~/Studentimg/" + FileUpload1.FileName, txtadd.Text, txtcity.Text, txtpin.Text, txtuname.Text, txtpass.Text);
            lblmsg.Text           = "Student Added.";
            txtname.Text          = "";
            txtadd.Text           = "";
            txtcity.Text          = "";
            txtemail.Text         = "";
            txtmobi.Text          = ""; txtpass.Text = "";
            txtpin.Text           = "";
            txtuname.Text         = "";
            txtcpass.Text         = "";
            drpdd.SelectedIndex   = 0;
            drpmm.SelectedIndex   = 0;
            drpyyyy.SelectedIndex = 0;


            DivDT       = DivAdapter.SELECT_BY_ID(Convert.ToInt32(drpdiv.SelectedValue));
            lblcnt.Text = "Total Seat = " + DivDT.Rows[0]["Seat"].ToString();
            MultiView1.ActiveViewIndex = 0;

            StuDT = StuAdapter.Select_By_STD_DIV(lblstd.Text, drpdiv.SelectedItem.Text);
            int rstu = Convert.ToInt32(DivDT.Rows[0]["Seat"].ToString()) - Convert.ToInt32(StuDT.Rows.Count.ToString());
            lblstudent.Text = "Total Admitted =" + StuDT.Rows.Count.ToString() + " , Remaining Student = " + rstu;

            string stddd = lblstd.Text.Substring(0, 1);
            int    rno   = Convert.ToInt32(StuDT.Rows.Count.ToString()) + 1;
            if (rno.ToString().Length < 2)
            {
                string newrno = "0" + rno.ToString();
                txtroll.Text = stddd + drpdiv.SelectedItem.Text + newrno;
            }
            else
            {
                txtroll.Text = stddd + drpdiv.SelectedItem.Text + rno;
            }
        }
    }
    protected void Button7_Click(object sender, EventArgs e)
    {
        DivDT       = DivAdapter.SELECT_BY_ID(Convert.ToInt32(drpdiv.SelectedValue));
        lblcnt.Text = "Total Seat = " + DivDT.Rows[0]["Seat"].ToString();
        MultiView1.ActiveViewIndex = 0;

        StuDT = StuAdapter.Select_By_STD_DIV(lblstd.Text, drpdiv.SelectedItem.Text);
        int rstu = Convert.ToInt32(DivDT.Rows[0]["Seat"].ToString()) - Convert.ToInt32(StuDT.Rows.Count.ToString());

        lblstudent.Text = "Total Admitted =" + StuDT.Rows.Count.ToString() + " , Remaining Student = " + rstu;

        string stddd = lblstd.Text.Substring(0, 1);
        int    rno   = Convert.ToInt32(StuDT.Rows.Count.ToString()) + 1;

        if (rno.ToString().Length < 2)
        {
            string newrno = "0" + rno.ToString();
            txtroll.Text = stddd + drpdiv.SelectedItem.Text + newrno;
        }
        else
        {
            txtroll.Text = stddd + drpdiv.SelectedItem.Text + rno;
        }
    }
Ejemplo n.º 6
0
 private void BindGridiv()
 {
     DivDT            = DivAdapter.SelectDiv();
     GvDiv.DataSource = DivDT;
     GvDiv.DataBind();
 }