protected void drpsociety_SelectedIndexChanged(object sender, EventArgs e) { if (drpsociety.SelectedIndex == 0) { lblhome.Text = ""; lblallocate.Text = ""; lblrem.Text = ""; } else { SDT = SAdapter.Select_By_SID(Convert.ToInt32(drpsociety.SelectedValue)); lblhome.Text = "Total House - " + SDT.Rows[0]["nohouse"].ToString(); ViewState["home"] = SDT.Rows[0]["nohouse"].ToString(); HDT = HAdapter.Select_BY_SNAME(drpsociety.SelectedItem.Text); if (HDT.Rows.Count == 0) { lblallocate.Text = "Allocated House - 0"; lblrem.Text = "Remaining House - " + SDT.Rows[0]["nohouse"].ToString(); } else { int rem = Convert.ToInt32(SDT.Rows[0]["nohouse"].ToString()) - HDT.Rows.Count; lblrem.Text = "Remaining House - " + rem.ToString(); lblallocate.Text = "Allocated House - " + HDT.Rows.Count.ToString(); } } }
protected void btnadd_Click(object sender, EventArgs e) { if (Convert.ToInt32(txtblockname.Text) > Convert.ToInt32(ViewState["home"].ToString())) { lblmsg.Text = "BlockNo must be less than total no of house"; lblmsg.ForeColor = System.Drawing.Color.Red; } else { SDT = SAdapter.Select_By_SID(Convert.ToInt32(drpsociety.SelectedValue)); HAdapter.Insert(Convert.ToInt32(txtblockname.Text), drptype.SelectedItem.Text, txtdetai.Text, drpsociety.SelectedItem.Text, SDT.Rows[0]["image"].ToString()); lblmsg.Text = "House Added Successfully"; lblmsg.ForeColor = System.Drawing.Color.Green; txtblockname.Text = ""; txtdetai.Text = ""; drptype.SelectedIndex = 0; SDT = SAdapter.Select_By_SID(Convert.ToInt32(drpsociety.SelectedValue)); lblhome.Text = "Total House - " + SDT.Rows[0]["nohouse"].ToString(); HDT = HAdapter.Select_BY_SNAME(drpsociety.SelectedItem.Text); if (HDT.Rows.Count == 0) { lblallocate.Text = "Allocated House - 0"; lblrem.Text = "Remaining House - " + SDT.Rows[0]["nohouse"].ToString(); } else { int rem = Convert.ToInt32(SDT.Rows[0]["nohouse"].ToString()) - HDT.Rows.Count; lblrem.Text = "Remaining House - " + rem.ToString(); lblallocate.Text = "Allocated House - " + HDT.Rows.Count.ToString(); } } }
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { GridView1.PageIndex = e.NewSelectedIndex; SDT = SAdapter.Select_Society(); GridView1.DataSource = SDT; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { lblmg.Text = ""; if (Page.IsPostBack == false) { SDT = SAdapter.Select_Society(); GridView1.DataSource = SDT; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { SDT = SAdapter.Select_Society(); drpsociety.DataSource = SDT; drpsociety.DataTextField = "SName"; drpsociety.DataValueField = "sid"; drpsociety.DataBind(); drpsociety.Items.Insert(0, "SELECT"); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { SDT = SAdapter.SelectTOP10(); DropDownList1.DataSource = SDT; DropDownList1.DataTextField = "Sname"; DropDownList1.DataValueField = "sid"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, "SELECT"); } lblsearch.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { lblmsg.Text = ""; if (Page.IsPostBack == false) { SDT = SAdapter.Select_Society(); drpsociety.DataSource = SDT; drpsociety.DataTextField = "SName"; drpsociety.DataValueField = "sid"; drpsociety.DataBind(); drpsociety.Items.Insert(0, "SELECT"); //HDT = HAdapter.SelectHouse(); //GridView1.DataSource = HDT; //GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["uid"] == null) { Response.Redirect("Default.aspx"); } else { UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString())); Image2.ImageUrl = UDT.Rows[0]["image"].ToString(); lblname.Text = Session["fname"].ToString(); if (Page.IsPostBack == false) { SDT = SAdapter.SelectTOP10(); GridView1.DataSource = SDT; GridView1.DataBind(); } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SDT = SAdapter.Select_By_SID(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value)); HDT = HAdapter.Select_BY_SNAME(SDT.Rows[0]["sname"].ToString()); if (HDT.Rows.Count > 0) { lblmg.Text = "Please, delete first all houses of this society"; } else { SAdapter.Delete(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value)); SDT = SAdapter.Select_Society(); GridView1.DataSource = SDT; GridView1.DataBind(); lblmg.Text = "Society Deleted"; } }
protected void btnadd_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/Society/") + txtsname.Text + "_" + FileUpload1.FileName); SAdapter.Insert(txtsname.Text, txtadd.Text, txtcity.Text, txtpincode.Text, Convert.ToInt32(txtnohouse.Text), "~/Society/" + txtsname.Text + "_" + FileUpload1.FileName.ToString()); lblmg.Text = "Society Added Successfully"; txtadd.Text = ""; txtcity.Text = ""; txtnohouse.Text = ""; txtpincode.Text = ""; txtsname.Text = ""; } else { lblmg.Text = "Select Society Photo"; } SDT = SAdapter.Select_Society(); GridView1.DataSource = SDT; GridView1.DataBind(); }