WebForm built-in Object Session object, application global object, ViewState detailed introduction _ Application Techniques

Source: Internet
Author: User
Tags eval

Session

Each computer to access the server, there are independent session,key values are the same, the content is different.

1.session is saved on the server.

2.session has no durability, the save cycle is 20 minutes.

Focus: Session do not abuse, do not use, misuse will cause server overflow, do not cause waste of resources.

Assign value: session["key" = value;
Value: String a = session["key"];
Clear: session["key"]=null;

Application

application["Key" is all users get the same value in this key, no save cycle, he will always be saved, usually as a version number

Assign value: application["key"]= value;
Value: Application.get ("key");

command action for repeater:

    1. ItemCommand Event--all controls that can trigger events in Repeater will trigger this event
    2. commandname--judge what button is clicked, E.commandname
    3. commandargument--the primary key value data that is passed by the triggering event, place the face boundary face value binding with the single quote E.
    4. ItemCreated-This event is executed once the HTML code is generated in the item template
    5. ItemDataBound-Item Template performs this event once after data is bound

Example:

 <ItemTemplate>
        <tr class= "Tr_item" style= <% #Eval ("Blue")%> ">
        <td><% #Eval (" UserName ")%></td>
        <td><% #Eval (" Password ")%></td>
        <td><% #Eval (" Nickname ")%></td>
        <td><% #Eval (" Sexname ")%></td>
        <td><% #Eval (" Birthdayn ")%></td>
          <td><% #Eval (" Age ")%></td>
        <td><% #Eval (" Nationname ")%></td>
          <td><asp:button id=" Button1 "runat=" server "text=" delete "Commandname=" Delete "commandargument= ' <% #Eval (" UserName ")%> '/> <asp:button id= ' Button2 ' runat= '
            server ' text= ' Modify the "commandname=" Xiugai "commandname=" delete "commandargument= ' <% #Eval (" UserName ")%> '/>
          </td>
          
          </tr>
      </ItemTemplate>

Background code:

 if (E.commandname = = "Delete")//delete button
    {
      new Userda (). Delete (e.commandargument.tostring ());
      Repeater1.datasource = new Userda (). Select ();
      Repeater1.databind ();
    }
    if (E.commandname = = "Xiugai")
    {
      new Userda (). Select (E.commandargument.tostring ());
      Repeater1.datasource = new Userda (). Select ();
      Repeater1.databind ();
    }

Through this article, I hope to help you understand this part of the knowledge, thank you for your support to this site!

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.