W
Wayne Wengert
I am trying to code a Sub to store some custom values in a profile for a new
user registration (ASP.NET 2.0 environment). I copied the basic code from an
example I found in a great article
(http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx ) but one of
my controls is a calendar control - see the p.DOB line in the code - and I
cannot figure out the syntax to use. In the code below, the ", text" at the
end get flagged with the error "Type expected".
If anyone can explain what is expected there I would really appreiate it.
Wayne
================= Code ================
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As
EventArgs)
' Create an empty Profile for the newly created user
Dim p As ProfileCommon =
CType(ProfileCommon.Create(CreateUserWizard1.UserName, True), ProfileCommon)
' Populate some Profile properties off of the create user wizard
p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("calDOB"),
Text)))
p.Sex =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("rblSex"),
RadioButton)).Text
p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("HomeState"),
TextBox)).Text
' Save profile - must be done since we explicitly created it
p.Save()
End Sub
user registration (ASP.NET 2.0 environment). I copied the basic code from an
example I found in a great article
(http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx ) but one of
my controls is a calendar control - see the p.DOB line in the code - and I
cannot figure out the syntax to use. In the code below, the ", text" at the
end get flagged with the error "Type expected".
If anyone can explain what is expected there I would really appreiate it.
Wayne
================= Code ================
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As
EventArgs)
' Create an empty Profile for the newly created user
Dim p As ProfileCommon =
CType(ProfileCommon.Create(CreateUserWizard1.UserName, True), ProfileCommon)
' Populate some Profile properties off of the create user wizard
p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("calDOB"),
Text)))
p.Sex =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("rblSex"),
RadioButton)).Text
p.HomeState =
(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("HomeState"),
TextBox)).Text
' Save profile - must be done since we explicitly created it
p.Save()
End Sub