Click here to Skip to main content
16,012,107 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all

In my project I have an textbox.This textbox is using for searching name.If I will type the letter according to that it will search the name from my contact table and bind the name,address,age in a gridview.

Please anybody know the solution to solve my problem.

thanks in advance!!
Posted
Updated 13-Jan-11 2:56am
v2
Comments
RaviRanjanKr 13-Jan-11 8:57am    
Please don't use short form of words like plz for please.
Espen Harlinn 13-Jan-11 9:13am    
Please show us some code, we might know the answer to your problem, but I for one need more information. Show us how you set up your bindings, are you using a LinqDataSource?

Try something like this.

C#
var query = from r in this.dtContacts.AsEnumerable()
                        where r.Field<string>("Name") == searchname
                        select new{ Age=r["Age"],Address=r["Address"]};


Also,if you want to search based on letter typed in textbox,try StartsWith property of string in where condition of LINQ.It should work,havent tried that.
 
Share this answer
 
v3
Comments
RaviRanjanKr 13-Jan-11 9:40am    
is He mention anything about XML?
Anupama Roy 13-Jan-11 9:41am    
I am not sure,if there is an XML,he has just mentioned contact table,hence I have used dtContacts which is a Datatable.
RaviRanjanKr 13-Jan-11 9:44am    
that's silly words if you are not sure I suggest you to ask questioner to be more clear. otherwise your answer will be down-voted by others.
be careful..
Anupama Roy 13-Jan-11 9:47am    
Thanks for the suggestion.He has not mentioned anything about XML then why should I ask about that?My example is just a suggestion to get it from a datatable & if people down-vote it,cant help.They must understand that we are here to help due to our willingness to share & help,a free service and not gaining anything out of it :)
Anupama Roy 13-Jan-11 9:49am    
Just curious,what makes you think that he is talking about xml?
If you are using a LinqDataSource you will probably find the LinqDataSource.Where and LinqDataSource.WhereParameters of interest.


Regards
Espen Harlinn
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900