protected void FindEmp() { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select Id,EmpName,EmpGroup,EMailId,MobNo "); StrSql.AppendLine("From Emp_Mast "); StrSql.AppendLine("Where 1=1 "); if (TxtFEmpName.Text.Length != 0) { StrSql.AppendLine(" And EmpName Like '" + TxtFEmpName.Text.ToString() + "%'"); } if (TxtFEmpGrp.Text.Length != 0) { StrSql.AppendLine(" And EmpGroup Like '" + TxtFEmpGrp.Text.ToString() + "%'"); } if (TxtFEMailId.Text.Length != 0) { StrSql.AppendLine(" And EMailId Like '" + TxtFEMailId.Text.ToString() + "%'"); } if (TxtFMobNo.Text.Length != 0) { StrSql.AppendLine(" And MobNo Like '" + TxtFMobNo.Text.ToString() + "%'"); } StrSql.AppendLine(" Order By EmpName"); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); GridEmp.DataSource = dtTemp; GridEmp.DataBind(); }
public void BindEmp() { con = new SqlConnection("Server=.;Integrated Security=SSPI;Database=ASPNET7;"); da = new SqlDataAdapter("select * from EMP", con); da.Fill(ds, "EMP"); GridEmp.DataSource = ds.Tables["EMP"]; GridEmp.DataBind(); }
internal void BindEmp() { cmd = new SqlCommand("Select * from Emp", conn); da = new SqlDataAdapter(cmd); ds = new DataSet(); da.Fill(ds); GridEmp.DataSource = ds.Tables[0]; GridEmp.DataBind(); }
protected void btnDisplay_Click(object sender, EventArgs e) { lblMsg.Text = ""; cmd = new SqlCommand("Select * from Employee", conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "empnew"); GridEmp.DataSource = ds.Tables["empnew"]; GridEmp.DataBind(); }
private void FillGrid() { try { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select Id,EmpName,EmpGroup,EMailId,MobNo"); StrSql.AppendLine("From Emp_Mast"); StrSql.AppendLine("Order By EmpName"); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); GridEmp.DataSource = dtTemp; GridEmp.DataBind(); } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void GridEmp_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridEmp.PageIndex = e.NewPageIndex; GridEmp.DataBind(); }
public void getAllEmployee(User u) { GridEmp.DataSource = merc.getAllEmployee(u); GridEmp.DataBind(); }