protected void Button1_Click(object sender, EventArgs e) { if (Session["username"] != null) { Button bt = (Button)sender; string s = bt.CommandName; dml ob = new dml(); ob.ad_delete(s); Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri); //DataTable dt = new DataTable(); //dt = ob.get_posted_ads(userid); //if (dt.Rows.Count > 0) //{ // Label1.Text = "Your Ads"; // DataList1.DataSource = dt; // DataList1.DataBind(); //} //else //{ // Label1.Text = "Oops!!! Seems like you haven't posted any ads"; //} } else { Session["flag"] = "1"; Response.Redirect("WebForm7.aspx"); } }