protected void grdLookup_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Save") { DropDownList ddllkup_group = grdLookup.FooterRow.FindControl("ddllkup_group") as DropDownList; TextBox txtlkup_desc = grdLookup.FooterRow.FindControl("txtlkup_desc") as TextBox; int afctrows; objData = new MasterData(); string groupvalue = ddllkup_group.SelectedItem.Value.Split('|').GetValue(0).ToString(); int groupsize = Convert.ToInt32(ddllkup_group.SelectedItem.Value.Split('|').GetValue(1).ToString()); if (groupsize < txtlkup_desc.Text.ToString().Length) { lblerrmsg.Text = "Check lookup value length"; return; } TextInfo textInfo = cultureInfo.TextInfo; afctrows = objData.Lookup_Insert(textInfo.ToTitleCase(txtlkup_desc.Text.Trim()), groupvalue); if (afctrows == 101) { lblerrmsg.Text = "Lookup already exists."; return; } grdfill(); divmsg.InnerHtml = "Record inserted successfully."; (this.Page.Master as Site1).ClearModifyStatus(); } } catch (Exception ex) { showerror(ex); } }