20151221:web Review: Modify

Source: Internet
Author: User


 Public Partial classupdate:system.web.ui.page{PrivateTextdatacontext context =NewTextdatacontext (); protected voidPage_Load (Objectsender, EventArgs e) {        if(session["UID"] !=NULL)        {            if(!IsPostBack) {                //bind data to a national drop-down listDrnation.datasource =context.                Nation; Drnation.datatextfield="Name"; Drnation.datavaluefield="Code";                Drnation.databind (); //take primary key value                stringCode = request["Code"].                ToString (); //Check the databaseInfo data = context.Info.Where (p = = P.code = =code).                First (); //fill in the dataTxtcode.text =data.                Code; txtName.Text=data.                Name; Txtbirthday.text= data. Birthday.Value.ToString ("yyyy mm month DD Day"); if(Data. Sex = =true) {Rdnan. Checked=true; }                Else{RDNV. Checked=true; }                foreach(ListItem Iteminchdrnation.items) {if(item. Value = =data. Nation) {Item. Selected=true; }                }            }        }        Else{Response.Redirect ("denglu.aspx"); }    }    protected voidButton1_Click (Objectsender, EventArgs e) {        //find this data .Info data = context.Info.Where (p = = P.code = =txtcode.text).        First (); //Modify ContentData. Name =txtName.Text; Data. Sex=Rdnan.        Checked; Data. Nation=Drnation.selectedvalue; Data. Birthday=Convert.todatetime (Txtbirthday.text); //Submitcontext.    SubmitChanges (); }    protected voidButton2_Click (Objectsender, EventArgs e) {Response.Redirect ("main.aspx"); }

20151221:web Review: Modify

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.