Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filterexpression

Status
Not open for further replies.

MaddogC

Programmer
Dec 4, 2003
134
0
0
GB
I have a gridview that is bound to an objectdatasource. I want to add a search box and button to my page. I have threfore added a filterexpression to the gridview. Firstly the Like statement in my filterexpression does not appear to be working. Secondly, how do I get the search button to refresh for a new search?


filterexpression="ORG_NAME LIKE '{0}'"
>
<filterparameters>
<asp:ControlParameter ControlID="txtSearch" PropertyName="Text" />

</filterparameters>
 
I imagine (as I prefer to hand-code database activity rather than use the built-in methods like the SqlDataSource) that you'll have to use something like:
Code:
                 ...
                 FilterExpression="ORG_NAME='{0}'">
                <FilterParameters>
                    <asp:ControlParameter Name="ORG_NAME" ControlId="txtSearch" PropertyName="Text"/>
                </FilterParameters>
                ...
Try using the above and see if it works. If it does, then it's the way you've set up the LIKE statement within the FilterExpression.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I've tried this already. It works fine with "=", can't see a problem with the LIKE though??
 
Maybe it's the object that is in your ObjectDataSource that can't handle LIKE statements, as the example in the help files works fine for me:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
The LIKE is working as long as I put the full string in. For example if I was searching by city and put in LONDON it works, however 'LON' in the search string returns nothing??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top