protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { try { int CityId = int.Parse(ddlCity.SelectedItem.Value); DataSet ds = LocationBusinessLayer.GetLocationByCity(CityId); BindDDL(ddlLocation, ds, "LocationName", "LocationID"); //if (ddlCity.SelectedItem.Text == "hyderabad") //{ // ddlLocation.Items.Add("Ameerpet"); // ddlLocation.Items.Add("KPHB"); // ddlLocation.Items.Add("AmberPet"); // ddlLocation.Items.Add("chinthal"); //} //else //{ // ddlLocation.Items.Add("ranipet"); // ddlLocation.Items.Add("spl"); //} ddlLocation.Items.Insert(0, "---Select---"); } catch (Exception) { lblMsg.Text = "Plz Select City...!"; } }
protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { ddlCity.Items[0].Enabled = false; int CityId = int.Parse(ddlCity.SelectedItem.Value); DataSet ds = LocationBusinessLayer.GetLocationByCity(CityId); BindDDL(ddlLocation, ds, "LocationName", "LocationID"); ddlLocation.Items.Insert(0, "---Select---"); lblUpdateAddress.Text = "Plz Select Location...."; }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int LocId = 0; Label l; l = (Label)GridView1.Rows[e.RowIndex].FindControl("lblLocationId"); LocId = int.Parse(l.Text); LocationBusinessLayer.DeleteLocation(LocId); ShowLocation(); }
protected void btnAddCity_Click(object sender, EventArgs e) { //Variable Declaration int CityId = 0; CityId = int.Parse(ddlCity.SelectedItem.Value); string Locname, LocDesc, LocCode, Pincode; //Initailization Locname = ""; LocDesc = ""; LocCode = ""; Pincode = ""; //Value Validation if (txtLocName.Text.Trim().Length > 0) { Locname = txtLocName.Text.Trim(); } else { lblMsg.Text = "Enter Location Name..."; } if (txtLocDesc.Text.Trim().Length > 0) { LocDesc = txtLocDesc.Text.Trim(); } else { lblMsg.Text = "Enter Location Description..."; } if (txtLocCode.Text.Trim().Length > 0) { LocCode = txtLocCode.Text.Trim(); } else { lblMsg.Text = "Enter Location Code..."; } if (txtPinCode.Text.Trim().Length > 0) { Pincode = txtPinCode.Text.Trim(); } else { lblMsg.Text = "Enter PinCode..."; } //Calling Location BusinessLayer LocationBusinessLayer.InsertLocation(Locname, LocDesc, LocCode, CityId, Pincode); lblMsg.Text = "Location Added Successfully..."; txtLocName.Focus(); }
protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { try { int CityId = int.Parse(ddlCity.SelectedItem.Value); DataSet ds = LocationBusinessLayer.GetLocationByCity(CityId); BindDDL(ddlLocation, ds, "LocationName", "LocationID"); ddlLocation.Items.Insert(0, "SELECT LOCATION"); } catch (Exception) { lblMsg.Text = "Plz Select City...!"; } }
protected void btnDelete_Click(object sender, EventArgs e) { CheckBox chk; foreach (GridViewRow gr in GridView1.Rows) { chk = (CheckBox)gr.FindControl("chkid"); if (chk.Checked == true) { int LocId = 0; Label l; l = (Label)gr.FindControl("lblLocationId"); LocId = int.Parse(l.Text); LocationBusinessLayer.DeleteLocation(LocId); ShowLocation(); } } }
public void ShowLocation() { GridView1.DataSource = LocationBusinessLayer.ShowLocation(); GridView1.DataBind(); }