Lalit Raghav
Lalit Raghav

Reputation: 59

Rename column in entity framework

I have a table 'UserLogin' which contains the columns: id and userid. Suppose I want to show userid as 'user' in Gridview then we write query in sql

select userid as user from UserLogin

But I am working with entity framework. How can we solve this problem in entity framework?

Upvotes: 3

Views: 1659

Answers (1)

Vojtěch Dohnal
Vojtěch Dohnal

Reputation: 8104

Usually you specify different Header text for that column within your GridView control.

But you can achieve similar functionality in Entity framework by using

select new { user = UserLogin.userid, id = UserLogin.id }; 

Upvotes: 3

Related Questions