protected void drpExam_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drpExam.SelectedIndex > 0)
     {
         DataRow dr = ExamMst.GetDataByKey(int.Parse(drpExam.SelectedValue));
         if (dr != null)
         {
             txttotalMarks.Text = dr["Total"].ToString();
         }
     }
 }
        protected void GvStd_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GvStd.EditIndex = e.NewEditIndex;
            DataRow drRole = ExamMst.GetDataByKey(int.Parse((GvStd.Rows[e.NewEditIndex].FindControl("lbl_SID") as Label).Text));

            GvStd.SelectedIndex = e.NewEditIndex;
            ExamID          = int.Parse((GvStd.Rows[e.NewEditIndex].FindControl("lbl_SID") as Label).Text);
            txtstdname.Text = drRole["Name"].ToString();
            e.Cancel        = true;

            txt_TotalMarks.Text = drRole["Total"].ToString();
            btnaddstd.Text      = "Update";
            BindGridStd();
        }
        protected void GvStd_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox tname = GvStd.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox;
            DataRow dr    = ExamMst.GetDataByKey(Convert.ToInt32(GvStd.DataKeys[e.RowIndex].Value));

            if (dr != null)
            {
                ExamMst std = new ExamMst();
                std.ExamID = Convert.ToInt32(GvStd.DataKeys[e.RowIndex].Value);
                std.Name   = txtstdname.Text;
                std.Total  = txt_TotalMarks.Text != "" ? decimal.Parse(txt_TotalMarks.Text) : 100;

                std.UpdateDataByKey();
                lbl.Text = "Record Updated Successfully";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "fadeLabelOut()", true);
            }

            GvStd.EditIndex = -1;
            BindGridStd();
        }