Datagrid Control in VS2005

R

rgelfand2

My goal is to apply data entered in multiple text boxes as parameters
for sqldatasource filter bound to a datagrid control

I have created an asp .net web page. To the page I added datagrid
control. The datagrid control getting it's data from sqldatasource.
The sqldatasource is defined as a straight select against one table.


I have, also, added textbox control to the same page. I have defined
filter parameter for the sqldatasource as textbox1.text. The filter
expression is yow_model_no like '%{0}%' .
This works.


If I try to add another text box and define another filter parameter.
In the filter expression I specify yow_model_no like '%{0}%' and
upc_code like '%{1}%'.
This doesn't work.


Could someone tell me where I went wrong here?


Thanks in advance
 
C

CaffieneRush

Works for me.
Selects all rows within Northwind.Customer table such that CustomerID
and ContactName columns contains at least an 'i' in it.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
FilterExpression="CustomerID LIKE '%{0}%' AND ContactName LIKE '%{1}%'"
SelectCommand="SELECT * FROM [Customers]">
<FilterParameters>
<asp:parameter DefaultValue="i" Name="p1" />
<asp:parameter DefaultValue="i" Name="p2" />
</FilterParameters>
</asp:SqlDataSource>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top