如何绑定特定用户数据并将其显示在aspx下拉菜单中? [英] how to bind particular users data and show it to in aspx dropdowns?
问题描述
登录表
LID(pk)
Login Table
LID(pk)
UserName Password Role
1 admin 123 True
2 Fahad 456 False
3 Farhan 789 False
table worlkallocation
WID(pk) LID BID TID
600 Fahad 10.3.2 test1
601 Fahad 10.3.2 test2
602 Fahad 10.5.2 Test3
603 Fahad 10.5.2 Test4
604 Farhan 10.5.2 Test1
605 Farhan 10.5.2 Test2
这是我的两个表..当我从特定用户登录时,我的意思是只有用户不在admin.aspx页面中(如果已登录),只有他的BID和TID应该显示..
aspx页面包含..
测试用例(作为标签)[下拉列表]
hi this is my two tables..when i login from particular user i mean only user not admin.in aspx page (if fahad login)only his BID and TID should show..
aspx page contains..
Testcase(as Label)[dropdownlist]
how to bind only if particular user logins..can any one suggest me..
推荐答案
很简单,
您可以通过两种方式进行操作
1).刚查询下拉数据源,如
如果您在登录后进行了会话
Very simple,
You can do it two ways
1). Just made Query for datasource of dropdown like
if you have made session after login
Select * from Table where LID='+ Session["username"].ToString()+'
2).在绑定DropDown之前,请检查User Role是否为true,然后进行数据绑定查询,如
2). Before binding DropDown check Role of User if it is true only then make query for databinding like
Select * from table;
否则像第一个查询
在这两种情况下,您都必须进行会话以识别显然已经建立的用户
希望你能理解:)
otherwise query like 1st one
In both cases you have to made session for identifying user which obviously you''ll have made
Hope you have understand :)
这篇关于如何绑定特定用户数据并将其显示在aspx下拉菜单中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!