( Spinning off from this thread: http://sharepointsolutions.zendesk.com/entries/131228 )
I want all new users to be created consistently with their UserName = [First Initial][Last Name]. Knowing we can't trust users to be consistent, I've added a "FirstName" and "LastName" field to my profile & registration page.
My plan was to set the UserName in the OnRegistration() event. First attempt produced an error:
c:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\WaTransit\Register.aspx(22): error CS0200: Property or indexer 'SPSolutions.SharePoint.Delegation.RegistrationEventProperties.UserName' cannot be assigned to -- it is read only at System.Web.Compilation.AssemblyBuilder.Compile()
OK - So, the UserName property needs to be set prior to the RegistrationEvent being created. However, by the time the OnRegister() event is called, the RegistrationEvent has (obviously) already been created.
Next attempt: Change the finish button to call a script that 1) sets the UserNameTextBox.Text to the appropriate value and 2)calls the FinishButton_Click. I think I'm close, but need help with the parameters with which to call the FinishButton_Click event.
Something like this (obviously the parameters are not correct, just fumbling around trying to figure out what it is looking for)
protected void OnFinish()
{
UserNameTextBox.Text = "mutton";
FinishButton_Click(UserNameTextBox.Text, PasswordTextBox.Text);
}
c:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\WaTransit\Register.aspx(25): error CS1502: The best overloaded method match for 'SPSolutions.SharePoint.Delegation.ApplicationPages.RegisterPage.FinishButton_Click(object, System.EventArgs)' has some invalid arguments at System.Web.Compilation.AssemblyBuilder.Compile()
Am I close, or totally off base?
4 Comments