3
Answers

searching with a dropdownlist

Ask a question
Mark Uy

Mark Uy

14y
2.5k
1
hey guys!

im having trouble of making a gridview work. the functionality is simple but im a little lost on how to make it work.

my interface looks like this

________________________________________________________________________________

now each item inside the dropdownlist is declared like this:

<asp:ListItem Value="UnitDesc">Description</asp:ListItem>

the value up there indicates a field name within my "unit" table.

_____________________________________________________________________

heres my code under my btn_click event:

  SqlDataSource1.SelectCommand = "SELECT * FROM [Unit] WHERE (' @DropDownList1 ' LIKE '%' + @UnitDesc + '%')";


  SqlDataSource1.DataBind();

btw @UnitDesc is the name of the textbox for the search input.

although it doesnt show any error, it doesnt work though. my datagrid wont show up.

what am i doing wrong?



Answers (3)