public partial class Admin_procat : System.Web.UI.Page { dbcon obj = new dbcon(); protected void Page_Load(object sender, EventArgs e) { //dbcon obj = new dbcon(); if (!IsPostBack) { string querydr = "select * from ESK_Categories"; SqlDataReader dr = obj.fillcomb(querydr); DropDownList1.DataSource = dr; DropDownList1.DataValueField = "CategoryName"; DropDownList1.DataBind(); // Response.Redirect("procat.aspx"); } if (!IsPostBack) { bind(); } } public void bind() { //string query = "select * from ESK_Products"; string query = "SELECT * FROM ESK_Products LEFT JOIN ESK_Categories ON ESK_Categories.CategoryID=ESK_Products.CategoryID Where ESK_Categories.CategoryName='" + DropDownList1.Text + "'"; DataSet ds = obj.fillgrid(query); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { //Response.Redirect("procat.aspx"); } }
AutoPostBack
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { // calling the bind method. bind(); //Response.Redirect("procat.aspx"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)