示例#1
0
        protected void gvInt_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow   row     = (GridViewRow)gvInt.Rows[e.RowIndex];
            List <string> LstInst = new List <string>();

            Label lblInstID = (gvInt.Rows[e.RowIndex].FindControl("lblInstID") as Label);

            LstInst.Add(lblInstID.Text);
            TextBox txtInstName = (TextBox)row.Cells[1].Controls[0];

            LstInst.Add(txtInstName.Text);
            LstInst.Add((gvInt.Rows[e.RowIndex].FindControl("ddlDept") as DropDownList).SelectedItem.Value);
            TextBox txtPhNum = (TextBox)row.Cells[3].Controls[0];

            if (CheckRegex("^[0-9-]*$", txtPhNum.Text) == false)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid Phone#')", true);
                return;
            }
            LstInst.Add(txtPhNum.Text);
            TextBox txtEmailID = (TextBox)row.Cells[4].Controls[0];

            if (CheckRegex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$", txtEmailID.Text) == false)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid Email ID')", true);
                return;
            }
            LstInst.Add(txtEmailID.Text);
            ViewState["LstInst"] = LstInst.ToArray();
            ODS_Inst.Update();
            gvInt.EditIndex = -1;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Record Updated Successfully')", true);
        }
示例#2
0
        protected void gvInt_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Label lblInstID = (gvInt.Rows[e.RowIndex].FindControl("lblInstID") as Label);

            ViewState["DelInstID"] = lblInstID.Text;
            ODS_Inst.Delete();
            gvInt.EditIndex = -1;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Record Deleted Successfully')", true);
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Cache[ODS_Inst.CacheKeyDependency] = "InstCache";
         //ViewState["blIsSearch"] = false;
         ODS_Inst.Select();
     }
 }
示例#4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BusinessObjects bo = new BusinessObjects();

                int retValue = bo.CheckDupUser(txtUserID.Text);
                if (retValue > 0)
                {
                    ViewState["UserState"] = "Instructor ID already exists";
                    Page.Validate();
                }
                else
                {
                    //Add user
                    //ViewState["blIsSearch"] = false;
                    ODS_Inst.Insert();
                    ODS_Inst.Select();
                    ResetFields();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Instructor Created Successfully')", true);
                }
            }
        }
示例#5
0
 protected void gvInt_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     gvInt.EditIndex = -1;
     //ViewState["blIsSearch"] = false;
     ODS_Inst.Select();
 }
示例#6
0
 protected void gvInt_RowEditing(object sender, GridViewEditEventArgs e)
 {
     gvInt.EditIndex = e.NewEditIndex;
     //ViewState["blIsSearch"] = false;
     ODS_Inst.Select();
 }