Datagrid Control in VS2005

Discussion in 'ASP .Net Web Controls' started by rgelfand2@hotmail.com, Jul 6, 2006.

  1. Guest

    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
    , Jul 6, 2006
    #1
    1. Advertising

  2. Guest

    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>

    wrote:
    > 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
    , Jul 6, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    466
    Ken Halter
    Jan 17, 2006
  2. InHyuk, Song
    Replies:
    2
    Views:
    2,039
    CJ Taylor
    Oct 13, 2004
  3. steffo

    control size problem vs2005

    steffo, Mar 11, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    347
    steffo
    Mar 11, 2005
  4. C Gatto
    Replies:
    0
    Views:
    454
    C Gatto
    Jun 2, 2005
  5. =?Utf-8?B?Q2hyaXMgRGF2b2xp?=

    What happened to DataGrid - VS2005

    =?Utf-8?B?Q2hyaXMgRGF2b2xp?=, Aug 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,426
    Mark Rae
    Aug 2, 2006
Loading...

Share This Page