Asp.net FormView在bind中调用字符串函数
我的网站(edituser.aspx)中有一个编辑用户页面。用户名和密码放在Access数据库中,我在FormView中显示它们。像这样:Asp.net FormView在bind中调用字符串函数,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,我的网站(edituser.aspx)中有一个编辑用户页面。用户名和密码放在Access数据库中,我在FormView中显示它们。像这样: <asp:FormView ID="EditForm" runat="server" DefaultMode="Edit"> <EditItemTemplate> <strong>username:</strong><br /> <asp:Text
<asp:FormView
ID="EditForm"
runat="server"
DefaultMode="Edit">
<EditItemTemplate>
<strong>username:</strong><br />
<asp:TextBox ID="usernameIDTextBox" runat="server" Text='<%# Bind("usernameID") %>' /><br />
<strong>Password:</strong><br />
<asp:TextBox ID="passwordIDTextBox" TextMode="password" runat="server" Text='<%# Bind("passwordID") %>' /><br />
... .
尝试使用Eval而不是Bind:
<%# Decrypt(Eval("passwordID")) %>
如果我从Bind切换到Eval。将出现错误:一个或多个必需参数没有给定值。
Public Function Decrypt(ByVal strDecoded_Pword As String) As String
On Error Resume Next
Dim i, ct As Integer
Dim letter, dec, StrValappend, strVal As String
dec = ""
strDecoded_Pword = StrReverse(strDecoded_Pword)
For ct = 1 To Len(strDecoded_Pword) Step 2
StrValappend = Chr(Val("&H" & (Mid(strDecoded_Pword, ct, 2))))
strVal = strVal & StrValappend
Next
strDecoded_Pword = strVal
For i = 1 To Len(strDecoded_Pword)
letter = Mid(strDecoded_Pword, i, 1)
dec = dec & Chr(Asc(letter) - i - 5)
Next
Decrypt = dec
End Function
<%# Decrypt(Eval("passwordID")) %>