Write an Article Write a Tutorial Add a Fast Code* *Fast Code might be any helpful code with brief comment
Stem Cells Blood Banks Insurances .Net Hosting Credit Cards PC Rental Business
Tutorials: ASP .NET C# .NET VB .NET Articles: ASP .NET C# .NET VB .NET Fast Code: ASP .NET C# .NET VB .NET
We will create a Registration Page where users will also provide us some optional entries. This is completly managed by ASP .NET 2.0 Profiling. Let us do it step by step.
Now, Right Click the page and go to "Code view" of the Page. add this code to the Page.
protected void WizardCreateUser_CreatedUser(object sender, EventArgs e) { ProfileCommon p = (ProfileCommon)ProfileCommon.Create(WizardCreateUser.UserName, true); p.FirstName = ((TextBox)WizardCreateUser.CreateUserStep.ContentTemplateContainer.FindControl("TextBoxFirstName")).Text; p.LastName = ((TextBox)WizardCreateUser.CreateUserStep.ContentTemplateContainer.FindControl("TextBoxLastName")).Text; p.Save(); }
Ok, still one more thing to be done. add these lines to you Web.config . This block of code will come between <system.web> system.web> .
Ok ,now you can view the page in the Browser. Create a new user. To view Users Profile you need to Create a Page. Call this Page "UserPrifile.aspx" .
How will you create UserPrifile page? See our Article Profiling in ASP .NET 2.0.
For VB remove "OnCreatedUser="WizardCreateUser_CreatedUser" " and add the following code in codebehind.
Protected Sub WizardCreateUser_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles WizardCreateUser.CreatedUser Dim p As ProfileCommon p = CType(ProfileCommon.Create(WizardCreateUser.UserName, True), ProfileCommon) p.FirstName = CType(WizardCreateUser.CreateUserStep.ContentTemplateContainer.FindControl("TextBoxFirstName"), TextBox).Text p.LastName = CType(WizardCreateUser.CreateUserStep.ContentTemplateContainer.FindControl("TextBoxLastName"),TextBox).Text p.Save() End Sub
30/12/2006 06:25:49 UTC
31/12/2007 08:10:07 UTC
17/01/2008 02:32:07 UTC
18/01/2008 08:37:07 UTC
this is great idea to write this type of program so that new developer can understand the code.
13/09/2008 05:05:31 UTC
29/12/2008 12:09:29 UTC
10/01/2009 04:36:46 UTC
16/01/2009 02:41:01 UTC