protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["username"] == null) { Response.Redirect("LoginPage.aspx"); } else { // Label9.Text = "Hello " + Session["username"].ToString(); } filldatalist(); if (Request.QueryString["cat"] != null) { Dlshop.DataSourceID = null; Dlshop.DataSource = SqlDataSource4; Dlshop.DataBind(); } } DataTable dt = new DataTable(); dt = (DataTable)Session["Buyitems"]; if (dt != null) { // Label7.Text = dt.Rows.Count.ToString(); } else { // Label7.Text = "0"; } }
public void filldatalist() { string s = "select * from productdetail"; SqlCommand cmd = new SqlCommand(); cmd.CommandText = s; cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "imp"); Dlshop.DataSource = ds; Dlshop.DataBind(); }
protected void LinkButton4_Click(object sender, EventArgs e) { Dlshop.DataSourceID = null; Dlshop.DataSource = SqlDataSource3; Dlshop.DataBind(); }