Mark Uy

Mark Uy

  • NA
  • 130
  • 0

searching with a dropdownlist

Nov 22 2009 6:39 AM
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)