asp.net - filter c# listview using filterexpression and multiple dropdowns -


i trying use filterexpression in code behind filter listview based on selection of 4 dropdowns. following code binds listview , fired onselectedindexchanged each of dropdowns...

using (sqldatasource varlistviewdatasource = new sqldatasource())     {         string custstr = custfiltdd.selectedvalue;         varlistviewdatasource.id = "varlistviewdatasource";         varlistviewdatasource.connectionstring = configurationmanager.connectionstrings["connectionstring"].connectionstring;         varlistviewdatasource.selectcommand = "select retdetails.varid, retdetails.status, retdetails.approvalstatus, job.jobname, customer.custid, customer.custname, retdetails.quoteref, retdetails.retcat, retdetails.approvalref, retdetails.fulldesc, retdetails.jobid, retdetails.description, retdetails.value, concat(contact.contactforename, ' ', contact.contactsurname) name, retstatus.retstatusdesc, retcats.retcatdesc retdetails inner join contact on retdetails.requestor = contact.contactid inner join retstatus on retdetails.status = retstatus.retstatusid inner join retcats on retdetails.retcat = retcats.retcatid  inner join job on retdetails.jobid = job.jobid inner join customer on job.custid = customer.custid";          if (custfiltdd.selectedvalue != "")         {             varlistviewdatasource.filterexpression = "custid = '" + custfiltdd.selectedvalue + "'";         }         if (jobfiltdd.selectedvalue != "")         {             varlistviewdatasource.filterexpression = "jobid = '" + jobfiltdd.selectedvalue + "'";         }         if (appfiltdd.selectedvalue != "")         {             varlistviewdatasource.filterexpression = "approvalstatus = '" + appfiltdd.selectedvalue + "'";        }         if (statfiltdd.selectedvalue != "")         {             varlistviewdatasource.filterexpression = "status = '" + statfiltdd.selectedvalue + "'";         }         varlistview.datasource = varlistviewdatasource;         varlistview.databind();     } 

i'm new , understand i'm way off using 4 separate filterexpressions , grateful pointers.

thanks


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -