protected void GridViewBranches_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         MyJobPortalModel.City ObjCity = new MyJobPortalModel.City(int.Parse(e.Row.Cells[1].Text));
         e.Row.Cells[1].Text = ObjCity.CityName;
     }
 }
Пример #2
0
    protected void LnkBtnEditCity_Click(object sender, EventArgs e)
    {
        EditCityModal.Visible = true;
        DataTable ObjCountryTable = MyJobPortalModel.Country.GetCountryRecords("status='Active'");

        DdlCountryEdit.DataSource = ObjCountryTable;
        DdlCountryEdit.DataBind();
        DdlCountryEdit.Items.Insert(0, new ListItem("--Select--", "--Select--"));
        DdlStateEdit.Items.Add(new ListItem("--Select--", "--Select--"));
        GridViewRow ObjCurrentRow = (GridViewRow)((LinkButton)sender).Parent.Parent;
        int         Id            = (int)GridView1.DataKeys[ObjCurrentRow.RowIndex]["Id"];

        HdnCityId.Value = Id.ToString();
        MyJobPortalModel.City ObjCityRecord = new MyJobPortalModel.City(Id);
        TxtCityNameEdit.Text         = ObjCityRecord.CityName;
        DdlCountryEdit.SelectedValue = ObjCityRecord.CountryId.ToString();
        DataTable ObjStateTable = MyJobPortalModel.State.GetStateRecords("status='Active' and CountryId=" + DdlCountryEdit.SelectedValue);

        DdlStateEdit.DataSource = ObjStateTable;
        DdlStateEdit.DataBind();
        DdlStateEdit.Items.Insert(0, new ListItem("--Select--", "--Select--"));
        DdlStateEdit.SelectedValue  = ObjCityRecord.StateId.ToString();
        DdlStatusEdit.SelectedValue = ObjCityRecord.Status.ToString();
    }
Пример #3
0
 protected void BtnUpdateCity_Click(object sender, EventArgs e)
 {
     if (this.IsValid == true)
     {
         if ((int)MyJobPortalModel.City.GetCityRecords("CityName='" + TxtCityNameEdit.Text + "' and Id<>" + HdnCityId.Value).Rows.Count > 0)
         {
             LblDuplicateCityNameErrorEdit.Visible = true;
             return;
         }
         else
         {
             MyJobPortalModel.City ObjNewCity = new MyJobPortalModel.City(int.Parse(HdnCityId.Value));
             ObjNewCity.CityName  = TxtCityNameEdit.Text;
             ObjNewCity.CountryId = int.Parse(DdlCountryEdit.SelectedValue);
             ObjNewCity.StateId   = int.Parse(DdlStateEdit.SelectedValue);
             ObjNewCity.Status    = DdlStatus.SelectedValue;
             ObjNewCity.Update();
             EditCityModal.Visible = false;
             TxtCityName.Focus();
             this.Form.DefaultButton = BtnGo.UniqueID;
             ShowGridView();
         }
     }
 }