Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have a table with fields supplier (char type ) catogory (type char)

i want to make supplier as request.query string and that bases i want to fill gridview .so what is c# code for it.
Posted
Comments
Sandeep Mewara 27-Jun-12 4:00am    
You should work/try first instead of seeking for a code. Once you try and get stuck, post specific issue.

1 solution

See if below code helps you:

C#
private string supplierName = string.Empty;
protected void Page_Load(object sender, EventArgs e)
    {
        supplierName = Convert.ToInt32(Request.QueryString["SupplierName"].ToString());
        if (!IsPostBack)
        {
            BindGridView();
        }
    }
 
    private void BindGridView()
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("SELECT * FROM tblCategory where SupplierName=" + supplierName , con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        con.Close();
        DataSet ds = new DataSet();
        da.Fill(ds);
        gridview1.DataSource = ds;
        gridview1.DataBind();
        
    }
 
Share this answer
 
v2
Comments
Ritu khatri 27-Jun-12 3:09am    
i dont want this i want name of supplier as query string
Vani Kulkarni 27-Jun-12 3:23am    
Ok send the supplier name instead of the supplier name. Edited the answer.
Prasad_Kulkarni 27-Jun-12 3:24am    
supplier name instead of the supplier name.
A bit confusing line.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900