Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hey there,

I am using a C# code to define where clause in LINQ. Can someone tell me, how to use this code in asp.net web application?

C#
string inpurUserName = txtName.Text.ToUpper().Trim();
reply= clientService.GetUsers(param,req);

var userTest = reply.Users.Where(x => x.Name == inpurUserName).ToList();


Thanks in advance...
Posted
Updated 9-Jun-14 20:43pm
v3
Comments
DamithSL 9-Jun-14 23:52pm    
what is clientService.GetUsers?
InboundIT 10-Jun-14 0:00am    
That is a web service.
Then it returns all the users & then I need to check whether the particular user is available. So that's why i created this linq & it returns 1 if there's values. This is working for C# desktop application. I need this same thing to be done in ASP.NET web app
DamithSL 10-Jun-14 0:05am    
you can copy past this code in to asp.net page code behind and test
if these methods are re usable for your web projects and desktop projects, then you better create separate class library for common methods.
then you can add reference to that class library from any of your project and call these methods
InboundIT 10-Jun-14 0:07am    
Infact this "WHERE" clause is not available in asp.net code behind
DamithSL 10-Jun-14 0:11am    
check my answer, you need to include using System.Linq;

1 solution

you need to include System.Linq as using directive at the top of your code behind file in asp.net
C#
using System.Linq;
 
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