在gridview中显示用户配置文件 [英] show user profile in gridview
本文介绍了在gridview中显示用户配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨每一个:
i希望用户登录时在欢迎页面上显示他/她的
名称并显示
$中的所有数据b $ b gridview如username,firstname,lastname。
hi every one:
i want that when user login then dispaly his/her
name on the welcome page and show all of the data in
gridview like username,firstname,lastname.
推荐答案
我不知道为什么你需要它。这是您的问题的解决方案。但我不认为向gridveiw显示用户配置文件是个好主意。因为gridview对于显示一些项目没有内存有效。
这是解决方案。首先,gridview与数据列表一起使用。因为你有一个数据我猜,但你还需要制作一个列表,以便用gridview显示它。
这是找出登录的方法user as a list:
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;
}
这里是绑定gridview的代码。
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....
这篇关于在gridview中显示用户配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文