i do no t know why do you need that. Here is a solution of your problem. but i do not think it will be a good idea to show the user profile to a gridveiw. Cause gridview is not memory effective to display a few items.
Here is the solution. First of all gridview works with list of data. As you have one one data i guess but you also need to make a list in order to display it with gridview.
This is the method to find out the logged in user as a list:
public List<User> GetUserByUserNamePassword(string UserName,string Password)
{
var availableUser= (from user in _DatabaseContext.Users
where user.FirstName == UserName && user.Password == Password
select user
).ToList();
return availableUser;
}
And here is the code for binding the gridview.
List<User> user = new UserBLL().GetUserByUserNamePassword("palash", "123");
if (user != null)
{
grvUser.DataSource = user;
grvUser.DataBind();
}
Hope it will help.
Happy coding....