Problem in search function!

  • Thread starter Thread starter Aal D via .NET 247
  • Start date Start date
A

Aal D via .NET 247

Hi,
i have a search function on my page. first i allow user to select from the dropdown a price.On btn_click i estalish Sql Connection..then ..creat command..and then creat dataview.
dv.RowFilter = "Price=here i want to have the selected value" from the dropdown
i have named DropDown as ddlComnapy...so my code looks like..
dv.RowFilter = "Price=ddlCompany.SelectedValue"
but on running the program it says:System.Data.EvaluateException: Cannot find column ddlcompany.SelectedValue
but if i hardcode a value ,then the code works perfectly fine.
CAN SOME BODY PLEASE POINT OUT WHERE I AM GOING WRONG
..NET ROCKS!
Aal
 
Change

dv.RowFilter = "Price=ddlCompany.SelectedValue"
to
dv.RowFilter = "Price=" + ddlCompany.SelectedValue <--- For C#
dv.RowFilter = "Price=" & ddlCompany.SelectedValue <--- For VB.NET

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/



Aal D via .NET 247 said:
Hi,
i have a search function on my page. first i allow user to select from the
dropdown a price.On btn_click i estalish Sql Connection..then ..creat
command..and then creat dataview.
dv.RowFilter = "Price=here i want to have the selected value" from the dropdown
i have named DropDown as ddlComnapy...so my code looks like..
dv.RowFilter = "Price=ddlCompany.SelectedValue"
but on running the program it says:System.Data.EvaluateException: Cannot
find column ddlcompany.SelectedValue
 
Back
Top