protected void grdCountryMaps_RowCommand(object sender, GridViewCommandEventArgs e) { try { Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString()); GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int index = row.RowIndex; if (e.CommandName == "Select") { dvMsgForDelete.Visible = false; grdMatchingCountry.DataSource = null; grdMatchingCountry.DataBind(); dvMatchingRecords.Visible = false; List <MDMSVC.DC_CountryMapping> obj = new List <MDMSVC.DC_CountryMapping>(); obj.Add(new MDMSVC.DC_CountryMapping { CountryMapping_Id = myRow_Id, //MapID = Convert.ToInt32(grdCountryMaps.Rows[index].Cells[0].Text), SupplierName = grdCountryMaps.Rows[index].Cells[1].Text, CountryCode = grdCountryMaps.Rows[index].Cells[2].Text, CountryName = grdCountryMaps.Rows[index].Cells[3].Text, Code = grdCountryMaps.Rows[index].Cells[4].Text, Name = grdCountryMaps.Rows[index].Cells[5].Text, Status = grdCountryMaps.Rows[index].Cells[7].Text }); //SupplierMasters sData = new SupplierMasters(); //sData = masters.GetSupplierDataByMapping_Id("country", myRow_Id); MDMSVC.DC_Supplier_DDL sData = new MDMSVC.DC_Supplier_DDL(); sData = _objMasterSVC.GetSupplierDataByMapping_Id("COUNTRY", Convert.ToString(myRow_Id)); string supCode = sData.Code; //string supCode = masters.GetSupplierCodeById(new Guid(grdCountryMaps.Rows[index].Cells[7].Text)); frmEditCountryMap.Visible = true; frmEditCountryMap.ChangeMode(FormViewMode.Edit); frmEditCountryMap.DataSource = obj; frmEditCountryMap.DataBind(); Label lblSupplierName = (Label)frmEditCountryMap.FindControl("lblSupplierName"); Label lblSupplierCode = (Label)frmEditCountryMap.FindControl("lblSupplierCode"); Label lblSupCountryName = (Label)frmEditCountryMap.FindControl("lblSupCountryName"); Label lblSupCountryCode = (Label)frmEditCountryMap.FindControl("lblSupCountryCode"); DropDownList ddlSystemCountryName = (DropDownList)frmEditCountryMap.FindControl("ddlSystemCountryName"); TextBox txtSystemCountryCode = (TextBox)frmEditCountryMap.FindControl("txtSystemCountryCode"); DropDownList ddlStatus = (DropDownList)frmEditCountryMap.FindControl("ddlStatus"); TextBox txtSystemRemark = (TextBox)frmEditCountryMap.FindControl("txtSystemRemark"); TextBox txtISO2CHAR = (TextBox)frmEditCountryMap.FindControl("txtISO2CHAR"); TextBox txtISO3CHAR = (TextBox)frmEditCountryMap.FindControl("txtISO3CHAR"); fillcountries(ddlSystemCountryName, ""); fillmappingstatus(ddlStatus); lblSupplierName.Text = System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[1].Text); lblSupplierCode.Text = "(" + supCode + ")"; lblSupCountryName.Text = System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[3].Text); lblSupCountryCode.Text = System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[2].Text); //txtSystemCountryCode.Text = System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[4].Text); txtSystemRemark.Text = masters.GetRemarksForMapping("country", myRow_Id); if (grdCountryMaps.Rows[index].Cells[7].Text.ToString() == "REVIEW" || grdCountryMaps.Rows[index].Cells[7].Text.ToString() == "MAPPED") { ddlSystemCountryName.SelectedIndex = ddlSystemCountryName.Items.IndexOf(ddlSystemCountryName.Items.FindByText(System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[5].Text))); ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByText(System.Web.HttpUtility.HtmlDecode(grdCountryMaps.Rows[index].Cells[7].Text))); var result = _objMasterSVC.GetCountryCodes(ddlSystemCountryName.SelectedValue); if (result != null && result.Count > 0) { txtSystemCountryCode.Text = result[0].Code; txtISO2CHAR.Text = result[0].ISO3166_1_Alpha_2; txtISO3CHAR.Text = result[0].ISO3166_1_Alpha_3; } } hdnFlag.Value = "false"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "javascript:showCountryMappingModal();", true); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "Pop1", "javascript:showCountryMappingModal();", false); } } catch { } }