我得到以下错误
“system.web.mvc.mvchtmlstring”类型的值无法转换为“integer”。
在
@html.actionlink(“编辑”,“编辑”,“用户”,用.id=model.id新建,无)
下面是代码
@If (Model.isUserMatch) Then
@<div>
@Html.ActionLink("edit", "Edit", "Users", New With {.id = Model.ID})
| <a href="#" onclick="jQuery('#OpenID').dialog('open'); return false">manage openids</a></div>
End If
有人知道为什么会这样吗?
编辑:
有人问我ViewModel是什么样子的
Imports System.Linq
Imports UrbanNow.Core.Extensions
Namespace Domain
Public Class UserViewModel
Public Property UserName As String
Public Property Email As String
Public Property Website As String
Public Property ID As Integer
Public Property OpenIds As List(Of OpenID)
Public Property UserAge As String
Public Property About As String
Public Property Slug As String
Public Property LastSeen As String
Public Property Region As String
Public Property MemberSince As String
Public Property Reputation As String
Public Property isUserMatch As Boolean = False
Private MarkDownSharp As MarkdownSharp.Markdown
Public Sub New(ByVal user As User)
Dim currentuser As Authentication.AuthUserData = Authentication.CustomAuthentication.RetrieveAuthUser
MarkDownSharp = New MarkdownSharp.Markdown
With MarkDownSharp
.AutoHyperlink = False
.AutoNewLines = True
.EncodeProblemUrlCharacters = True
.LinkEmails = True
.StrictBoldItalic = True
End With
''
''
''
''
_UserName = If(Not user.UserName Is Nothing, user.UserName, "User" & user.ID.ToString)
''
''
_Email = user.Email
_Website = user.WebSite
_ID = user.ID
_MemberSince = user.MemberSince
''
_OpenIds = user.OpenIDs.ToList
''
_UserAge = user.BirthDate.ToAge ''
''
''
''
''
''
''
_About = Trim(Utilities.HtmlSanitizer.Sanitize(MarkDownSharp.Transform(user.About)))
''
''
_Slug = Replace(user.UserName, " ", "-")
''
''
''
_isUserMatch = If(currentuser.ID = user.ID, True, False)
''
''
_LastSeen = user.ActivityLogs.Reverse.FirstOrDefault.ActivityDate
''
''
_Reputation = user.Reputation.ToShortHandNumber
''
_Region = user.Region.Region.FirstOrDefault
End Sub
End Class
End Namespace