Click here to Skip to main content
16,017,650 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Facid Facname

1 ram
2 suresh
3 vignesh
4 yadhav
5 kumar


Bthfac table as follows

Bfid Facid

1 1,2
2 2,3
3 3,4
4 4,5



code as follows in show button


C#
sql = "select distinct r.rate,f.bfid as BFid,CASE  FROM bthfac AS f,batch b,facfeedback  r where month(b.examdate)= '" + Ddlmonth.Text.ToString() + "' and  year(b.examdate)=  '" + DropDownList2.Text.ToString() + "' and r.bfid=f.bfid and b.bthid=f.bthid and f.facid = ' +  DropDownList4.Text.ToString().Trim() + '";
 dr = scon.ReadSql(sql);
 GridView.DataSource = dr;
 GridView.DataBind();
 GridView.Visible = true;



in run mode as follows;

Month ddlmonth (dropdownlist)
Year dropdownlist2
facid dropdownlist4


for example in run mode select the month,year and facid from the dropdownlist

Month 10
Year 2011
facid 1,2


when i select the three dropdownlist values and click the Show button.

in gridview records not displaying.

please help me.

what is the problem in my above code.


i think in dropdownlist4 facid values is 1,2. so we have to split the facid .


please help me.

Regards,
Narasiman P.
Posted
Updated 15-May-13 22:56pm
v2
Comments
Hemant Singh Rautela 16-May-13 5:15am    
use the Debugger and find what value in dr --> dr = scon.ReadSql(sql);....
Mayur Panchal 16-May-13 7:04am    
Yes, you need to debug the code. Find what the actual query is executed and try that query to execute in SQL query editor then you will find what the actual problem is.
RelicV 16-May-13 7:56am    
also, try this
f.facid IN (" + DropDownList4.Text.ToString().Trim() + ")";
instead of
f.facid = ' + DropDownList4.Text.ToString().Trim() + '";

Remove the ddl.Text.Tostring() and Place Ddl.SelectedText and Debug the code
 
Share this answer
 
You have to go into the Gridview Control and configure it to be bound to the dropdown boxes.
 
Share this answer
 

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