private void FillGrid() { DataTable dt = new DataTable(); dt = new BALCountryMaster().Select(new BOLCountryMaster()); gvCountry.DataSource = dt; gvCountry.DataBind(); }
protected void lnkbtnEdit_Click(object sender, EventArgs e) { LinkButton btnEdit = sender as LinkButton; GridViewRow gr = (GridViewRow)btnEdit.NamingContainer; Label lblId1 = (Label)gvCountry.Rows[gr.RowIndex].FindControl("lblId"); DataTable dt = new BALCountryMaster().Select(new BOLCountryMaster() { Id = int.Parse(lblId1.Text) }); if (dt.Rows.Count > 0) { lblId.Text = lblId1.Text; txtCountry.Text = dt.Rows[0]["Country"].ToString(); } pnlData.Visible = true; pnlGrid.Visible = false; btnSubmit.Text = "Update"; txtCountry.Focus(); }