protected void ibtnOwner_Click(object sender, ImageClickEventArgs e) { GridView gvowner = (GridView)Master.FindControl("grdview"); Ownerbind(); } public void Ownerbind() { MasterPage mp = this.Master; GridView gvowner = (GridView)mp.FindControl("grdview"); String Bind = "SELECT [OwnId],[OwnerCode],[FirstName],[LastName],[MobileNo],[Email] FROM [WebCrm].[dbo].[tbl_Owner]"; SqlConnection con = new SqlConnection(cn.ConnectionStrings); con.Open(); adp = new SqlDataAdapter(Bind, con); DataSet ds = new DataSet(); adp.Fill(ds); con.Close(); if (ds.Tables[0].Rows.Count > 0) { gvowner.DataSource = ds; gvowner.DataBind(); } else { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); gvowner.DataSource = ds; gvowner.DataBind(); int columncount = gvowner.Rows[0].Cells.Count; gvowner.Rows[0].Cells.Clear(); gvowner.Rows[0].Cells.Add(new TableCell()); gvowner.Rows[0].Cells[0].ColumnSpan = columncount; gvowner.Rows[0].Cells[0].Text = "No Records Found"; } } protected void grdview_RowEditing(object sender, GridViewEditEventArgs e) { MasterPage mp = this.Master; GridView gvowner = (GridView)mp.FindControl("grdview"); gvowner.EditIndex = e.NewEditIndex; Ownerbind(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)