2014年7月13日 星期日

[RESOLVED] i have a problem with web form has a multi creatria textbox for search ?


i have a web form with creatria textbox for search through sqldatasource and binding data to gridview,my problem that i have to fill all textbox's to get records into gridview,whenever i leave a textbox empty there are not records get into grid view !


how to fix it to let users fill some of textbox's and leave others empty ?


iam using asp.net / c#


 


thanks for help



I think you need to add required filed validators to the required text boxes in your  web form....




thanks,



Try this : select * from tbl where field1 like '%' + @param1 + '%' and field2 like '%' + @param2 + '%' ..... Then set DefaultValue="%" for both SqlDataSource select parameters.

Thanks for reply, I already try this solution,but no results in gridview .. I have to fill all textbox's controls to get results !

i retry this syntax but with default value    %      without ""


and it going well


thanks


沒有留言:

張貼留言