Home All Groups Group Topic Archive Search About

Can't Figure Out Correct Syntax

Author
15 Feb 2006 2:03 PM
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

Author
15 Feb 2006 6:27 PM
tomb
Wayne Wengert wrote:

Show quoteHide quote
>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
>
>

>
Maybe because you're using date.parse, all you need is to change the
comma to a period,

p.DOB =
Date.Parse((CType(CreateUserWizard1.CreateUserStep.
ContentTemplateContainer.FindControl("calDOB").Text)))

I'm only guessing - I don't do asp.net.

Tom
Author
15 Feb 2006 6:34 PM
Wayne Wengert
Tom;
I appreciate the suggestion. That doesn't work. It flags the entire line as
"Text is not a member...). What is strange, when I use the "," Intellisense
offers lots of options, including "text"?

Wayne

Show quoteHide quote
"tomb" <t***@technetcenter.com> wrote in message
news:MmKIf.45787$697.42571@bignews3.bellsouth.net...
> Wayne Wengert wrote:
>
>>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
>>
>>
>>
> Maybe because you're using date.parse, all you need is to change the comma
> to a period,
>
> p.DOB = Date.Parse((CType(CreateUserWizard1.CreateUserStep.
> ContentTemplateContainer.FindControl("calDOB").Text)))
>
> I'm only guessing - I don't do asp.net.
>
> Tom