public void GetUserDistrict() { if (Session["User"] != null) { InsertCandidateTableAdapter IT = new InsertCandidateTableAdapter(); string ID1 = Request.QueryString["id"]; object Chk1 = IT.CheckUserDistrict(ID1); bool Check1 = Convert.ToBoolean(Chk1); if (Check1 == true) { CheckUserDistrict_pnl.Enabled = true; } else { msg_lbl.Visible = true; msg_lbl.Text = "Elections Are Not Conducted In Your State OR The Elections are over in your State"; CheckUserDistrict_pnl.Enabled = false; } } }
protected void Confirm_btn_Click(object sender, EventArgs e) { if (Page.IsValid) { InsertCandidateTableAdapter IC = new InsertCandidateTableAdapter(); object Chk = IC.InsertCandidate(User_txt.Text, Party_ddl.SelectedValue, District_ddl.SelectedValue); bool Check = Convert.ToBoolean(Chk); if (Check == true) { //Confirm_lbl.Text = "Canidate Registered"; //Response.Redirect("OficerRegistration.aspx"); ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Oficer Added successfully.');window.location='OficerRegistration.aspx';", true); } else { Confirm_lbl.Text = "Canidate Cannot be Registered At This Moment"; User_txt.Text = ""; Party_ddl.SelectedIndex = -1; District_ddl.SelectedIndex = -1; } } }