Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
SqlDataAdapter da = new SqlDataAdapter("select p.rid,pf.uname,e.education from Personal p join Profile pf on p.rid=pf.rid join  education e on p.edu_id= e.edu_id where  e.education='"+edu.SelectedValue+"'", cn);
    
        //SqlDataAdapter da = new SqlDataAdapter("select image from uplodimage where rid=" + Session["rid"], cn);
        DataSet ds = new DataSet();
        da.Fill(ds);
       GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();


What I have tried:

SqlDataAdapter da = new SqlDataAdapter("select p.rid,pf.uname,e.education from Personal p join Profile pf on p.rid=pf.rid join education e on p.edu_id= e.edu_id where e.education='"+edu.SelectedValue+"'", cn);

//SqlDataAdapter da = new SqlDataAdapter("select image from uplodimage where rid=" + Session["rid"], cn);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
Posted
Updated 4-Oct-16 1:46am
Comments
OriginalGriff 4-Oct-16 7:17am    
And?
What happens that you didn't expect, or doesn't happen that you did?
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
[no name] 4-Oct-16 7:23am    
Never mind not being a good question, it's not a question at all. This is just an incomplete code dump.

1 solution

Hi,
My understanding of your question is, you have to bind the grid based on the selected value in the dropdownlist.
If it is so, then "edu.SelectedValue" is not correct.
if the dropdownlist id is "dropdownlist1" then the where condition will be "dropdownlist1.SelectedItem.Value" or dropdownlist1.SelectedItem.Text



C#
SqlDataAdapter da = new SqlDataAdapter("select p.rid,pf.uname,e.education from Personal p join Profile pf on p.rid=pf.rid join  education e on p.edu_id= e.edu_id where  e.education='"+dropdownlist1.SelectedItem.Value+"'", cn);
 
Share this answer
 
v2

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