protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { gvbind(); } Grdview.Visible = true; Label3.Visible = false; SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); ds = adm.DisplayAllOutPat(); //ds = pcObjforbll.DisplayGvbind(); if (ds.Tables[0].Rows.Count > 0) { Grdview.DataSource = ds; Grdview.DataBind(); } else { //MessageBox.Show("No records found", "", MessageBoxButtons.OK, MessageBoxIcon.Information); //String msg = "No records found"; //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + msg + "');", true); } }
protected void gvbind() { SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); ds = adm.DisplayAllInPat(); //ds = pcObjforbll.DisplayGvbind(); if (ds.Tables[0].Rows.Count > 0) { Grdview.DataSource = ds; Grdview.DataBind(); } else { MessageBox.Show("No records found", "", MessageBoxButtons.OK, MessageBoxIcon.Information); //String msg = "No records found"; //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + msg + "');", true); } }
public void BindGrid() { List <User> Info = new List <User>(); for (int i = 0; i < 5; i++) { Info[i].UserID = "3f2b12b8-2a06-45b4-b057-45949279b4e5"; Info[i].UserID = "197104"; Info[i].UserID = "Debit"; Info[i].UserID = "Payment"; Info[i].UserID = "2016-07-01T00:00:00"; Info[i].UserID = "true"; Info[i].UserID = "2016-07-01T00:00:00"; } Grdview.DataSource = Info; Grdview.DataBind(); //lblApplicationID.Text = "197104"; //lblTypeSummary.Text = "Debit"; //lblAmount.Text = "Payment"; //lblPostingDate.Text = "2016-07-01T00:00:00"; //lblIscleared.Text = "true"; //lblclearedDate.Text = "2016-07-01T00:00:00"; // Label lblUserID = (Label)Grdview.FindControl("lblUserID"); // Label lblApplicationID = (Label)Grdview.FindControl("lblApplicationID"); // Label lblTypeSummary = (Label)Grdview.FindControl("lblTypeSummary"); // Label lblAmount = (Label)Grdview.FindControl("lblAmount"); // Label lblPostingDate = (Label)Grdview.FindControl("lblPostingDate"); // Label lblIscleared = (Label)Grdview.FindControl("lblIscleared"); // Label lblclearedDate = (Label)Grdview.FindControl("lblclearedDate"); //Grdview.DataSource = 2; //Grdview.DataBind(); //lblUserID.Text = "3f2b12b8-2a06-45b4-b057-45949279b4e5" ; //lblApplicationID.Text = "197104"; //lblTypeSummary.Text = "Debit"; //lblAmount.Text = "Payment"; //lblPostingDate.Text = "2016-07-01T00:00:00"; //lblIscleared.Text = "true"; //lblclearedDate.Text = "2016-07-01T00:00:00"; }