Ejemplo n.º 1
0
        protected void grdState_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Save")
                {
                    DropDownList ddlCountry = grdState.FooterRow.FindControl("ddlCountry") as DropDownList;
                    TextBox txtStateName = grdState.FooterRow.FindControl("txtStateName") as TextBox;
                    int afctrows;
                    objData = new MasterData();
                    TextInfo textInfo = cultureInfo.TextInfo;
                    afctrows = objData.State_Insert(textInfo.ToTitleCase(txtStateName.Text.Trim()), Convert.ToInt32(ddlCountry.SelectedItem.Value));
                    if (afctrows == 101)
                    {
                        lblerrmsg.Text = "State already exists.";
                        return;
                    }
                    grdfill();
                    divmsg.InnerHtml = "Record inserted successfully.";
                    (this.Master as Site1).ClearModifyStatus();
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }