Ejemplo n.º 1
0
 protected void grdCountry_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         TextBox txtCountryEdit = grdCountry.Rows[e.RowIndex].FindControl("txtCountryEdit") as TextBox;
         HiddenField hdfCountryid = grdCountry.Rows[e.RowIndex].FindControl("hdfCountryid") as HiddenField;
         CheckBox chkStatus = grdCountry.Rows[e.RowIndex].FindControl("chkStatus") as CheckBox;
         if (txtCountryEdit.Text.Length == 0)
         {
             lblerrmsg.Text = "Country name should not be empty";
             return;
         }
         string status;
         if (chkStatus.Checked == true)
         {
             status = "Y";
         }
         else
         {
             status = "N";
         }
         int afctrows;
         objData = new MasterData();
         TextInfo textInfo = cultureInfo.TextInfo;
         afctrows = objData.Country_Update(textInfo.ToTitleCase(txtCountryEdit.Text.Trim()), Convert.ToInt32(hdfCountryid.Value.Trim()), status);
         if (afctrows == 102)
         {
             lblerrmsg.Text = "Country already exists.";
             return;
         }
         else if (afctrows == 103)
         {
             lblerrmsg.Text = "Country can’t be deleted as is in use by an state";
             return;
         }
         grdCountry.EditIndex = -1;
         grdfill();
         divmsg.InnerHtml = "Record updated successfully!";
         (this.Master as Site1).ClearModifyStatus();
     }
     catch (Exception ex)
     {
         showerror(ex);
     }
 }