ASP.NET
  Home arrow ASP.NET arrow Page 3 - User Information Management for an ASP.NET...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

User Information Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2008-01-09

    Table of Contents:
  • User Information Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website
  • Modifying Personal Info
  • Page Initialization
  • Viewing Personal Info

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    User Information Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website - Page Initialization


    (Page 3 of 4 )


    Page Initialization

    When the page is initialized, we should finish the task of loading the original user data and display it to them.

    protected void Page_Load(object sender,EventArgs e) {

    ///Get the value of the parameter

    if(Request.Params["UserID"] != null) {

    if(Int32.TryParse(Request.Params["UserID"].ToString(),out nUserID) == false) {

    return;

    }

    }

    if(!Page.IsPostBack) {

    ///bind data to the control

    if(nUserID > -1) {

    BindUserData(nUserID);

    }

    }

    SureBtn.Enabled = nUserID <= -1 ? false : true;

    }

    private void BindUserData(int nUserID) {

    ///Get the data

    User user = new User();

    SqlDataReader recr = user.GetSingleUser(nUserID);

    ///Read the data

    if(recr.Read()){

    ///display data

    UserName.Text = recr["UserName"].ToString();

    RealName.Text = recr["RealName"].ToString();

    Email.Text = recr["Email"].ToString();

    Phone.Text = recr["Phone"].ToString();

    Mobile.Text = recr["Mobile"].ToString();

    Remark.Text = recr["Remark"].ToString();

    Address.Text = recr["Address"].ToString();

    }

    recr.Close(); ///Close the data source

    }

    Here we still provide enough comments to which you can refer. Please remember that no matter which page you analyze in this sample, the basic initialization logic is quite similar. That will help you find your focus.


    Submitting the Modification

    Clicking the "OK" button will trigger its corresponding event handler, as follows:

    protected void SureBtn_Click(object sender,EventArgs e){

    User user = new User();

    user.UpdateUser(nUserID,RealName.Text,

    Address.Text,Phone.Text,Mobile.Text,

    Email.Text,Remark.Text);

    Response.Write("<script>window.alert('Changing user info successfully!')</script>");

    }

    Here, we first create an instance of the User class, and then invoke its UpdateUser member functionto finally submit the personal information to change the server side database. That’s it. As for the inner workings relating to UpdateUseritself, please refer to the downloadable source code accompanying this article.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek