使用VB.net编辑动态数据中的DropDownList [英] Editing DropDownList in Dynamic Data using VB.net
问题描述
嗨
我有两个表User& UsersInRoles
用户表已获得:
用户ID
姓氏
Sirname
等
UsersInRoles已获得:
UsersInRolesID
用户ID
RoleID
(仅3列)
我有两个下拉菜单
角色:只读/管理/编辑
用户:John/Harry/Chris
& 路径为/UsersInRoles/Insert.aspx
现在,我想在用户下拉列表"中显示姓氏+姓氏".我添加了一个名为UsersInRole.vb的类文件,代码如下:
< MetadataType(GetType(UsersInRoleMetaData))> _
部分公共类UsersInRole
< uihint("userinrole_enumeration")>
公共ReadOnly属性FullUserName()作为字符串
获取
Dim x As String = Me.User.Forename& "& Me.User.Surname
返回x
结束获取
最终财产
结束类
< displayname("user> 在UsersInRoles中找不到属性".
谁能告诉我,我在哪里做错了.我的意思是我真的很困惑,在哪里进行更改以及应该添加哪个新文件.谁能给我发送一些结构解决方案.这将是很大的帮助.
希望很快能收到您的回音.
谢谢
Hi
I have two tables User & UsersInRoles
User Table has got:
UserID
Forename
Sirname
etc.
UsersInRoles has got:
UsersInRolesID
UserID
RoleID
(Just 3 Columns)
I have two dropdowns
Role : Readonly/Admin/Edit
User: John/Harry/Chris
& the path is /UsersInRoles/Insert.aspx
Now, I want to display the Forename + Surname in User DropDown. I added a class file with the name UsersInRole.vb and the code is below:
<MetadataType(GetType(UsersInRoleMetaData))> _
Partial Public Class UsersInRole
<uihint("userinrole_enumeration")>
Public ReadOnly Property FullUserName() As String
Get
Dim x As String = Me.User.Forename & " " & Me.User.Surname
Return x
End Get
End Property
End Class
<displayname("user>Property not found in UsersInRoles".
Can anyone please tell me, where am I doing the wrong. I mean I am really confused about it, where to make the changes and which new file should I add. Can anyone please send me some solution with structure. It would be a great help.
Looking forward to hear from you soon.
Thanks
推荐答案
您是否已经有一个名为UsersInRoles的类?为什么不将属性添加到该类而不是使用局部类呢? Me.User与角色表中的用户有何关系? Me.User是与实例中的UserId关联的User吗?我认为我们还需要查看其他类,并且我们还需要知道什么代码会产生此错误.
Did you already have a class called UsersInRoles ? Why not add the property to that class instead of using a partial class ? How does Me.User relate to the users in roles table ? Me.User is the User associated with the UserId in the instance ? I think there''s other classes we need to see, and we also need to know what code generates this error.
这篇关于使用VB.net编辑动态数据中的DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!