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 in Roles")> _
Public Class UsersInRoleMetaData
'<UIHint("UsersInRole_ForeignKey")>
'Public FullUserName As Object
End Class
I tried most the things you mentioned, but when i try to access the Surname, it says "Property not found in UsersInRoles".
Can you 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 you please send me some solution with structure. It would be a great help.
Samthapar
Member
28 Points
17 Posts
Re: Problem in Populating DropDownList with two Columns of a Table using Dynamic Data with VB.Net
Feb 13, 2012 04:06 PM|LINK
Hi Sjnaughton
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 in Roles")> _
Public Class UsersInRoleMetaData
'<UIHint("UsersInRole_ForeignKey")>
'Public FullUserName As Object
End Class
I tried most the things you mentioned, but when i try to access the Surname, it says "Property not found in UsersInRoles".
Can you 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 you please send me some solution with structure. It would be a great help.
Looking forward to hear from you soon.
Thanks