Friday, May 8, 2009

Passing userid into textbox in FormView - ASP.NET Forums

Passing userid into textbox in FormView - ASP.NET Forums: "Ah, I see what you mean. However, now it's saying 'Conversion failed when converting from a character string to uniqueidentifier.' when I try to log in. Why is this? I didn't think placing a string into a textbox would cause any problems? Do I need to convert it back first? How would i do that?
Apparently it's possible to use an SQL CONVERT command to convert the string (varchar) to a uniqueidentifier. I'm just trying to work out how to do that....


Here is my code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim UserID As String
Dim MemUser As MembershipUser
Dim UserIDtb As TextBox = CType(FormView1.FindControl('UserIDTextBox'), TextBox)

MemUser = Membership.GetUser()
UserID = MemUser.ProviderUserKey.ToString()
UserIDtb.Text = UserID
End Sub"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

More Important Links

Followers