Showing posts with label similar. Show all posts
Showing posts with label similar. Show all posts

Thursday, March 29, 2012

Set controls to nothing when finished?

Hello,
I recently saw some example code that looked similar to the following...

...
Dim literalBr As New System.Web.UI.LiteralControl()
literalBr.Text = "<br>"
literalBr.ID = "anId"
Panel1.Controls.Add(literalBr)
literalBr = Nothing
...

Is there a reason why the literalBr control was set to nothing after adding it to the panel? Does it cause memory usage to go up if you dont set controls to nothing after creating them programmatically?The garbage collector will take care cleaning up literalBr in this case. Setting literalBr to nothing is a waste of time. SeeProgramming for Garbage Collection for more details.

Monday, March 26, 2012

Set Email address as username

I am wanting to do something similar except I want to remove the UserName field as our database uses the email field to logon.

Of course I would just make the email field as UserName but it requires the email field as well.

So am I going to have to write my own provider just to remove one simple text box?

All help greatly appreciated :)

That seems like a lot of work just to use the email address as the username. Im doing the same thing in my current project, however i'm simply populating both fields with the entered email address. My suggestion would be to use the standard ASP.NET membership provider.
I used the ASP:Wizard control instead and used parameters to pass the values to the database. Thanks though.

ecbruck:

That seems like a lot of work just to use the email address as the username. Im doing the same thing in my current project, however i'm simply populating both fields with the entered email address. My suggestion would be to use the standard ASP.NET membership provider.

What event do you do this and do you have email validation and unique Username working? I was thinking of trying this myself but just using the stock Username and trying to get another validation control working on it for the email check.


That's exactly what I did. I set the UserName to be unique, and I added a RegularExpressionValidator to handle the email address validation. I'm not sure what you are asking in terms of an event, as everything else in the Membership Provider remains the same.

ok great thanks for the fast reply. I thought that you might have to override the event to add the reg exp validation.