how to relate a category with subcategory and display in gridview using databind in asp.net using c#?
<p>how to relate category with subcategory and display the data in grid view with databound from database in asp.net?</p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
    {
        {
            if (Page.IsPostBack == false)
                bind();
        }
    }

private void bind()
{
    string subcat1 = "" + Session["subcat"];
    SqlDataAdapter adp = new SqlDataAdapter("select * from catsubcat where subcategory='" + subcat1 + "' and category='electronics'", Class1.getconnectionstring());
    DataSet ds = new DataSet();
    adp.Fill(ds);
    GridView1.DataSource = ds;
    GridView1.DataBind();

}
</code></pre>
