Session
Each computer accesses the server, has the independent Session,key value is identical, the content is different.
1.session is saved on the server.
2.session has no persistence, and the save period is 20 minutes.
Focus: Do not abuse the session, do not use, misuse will cause server overflow, do not cause waste of resources.
Assignment: session["key"] = value;
Value: String a = session["key"];
Clear: session["key"]=null;
Application
application["Key"] is all the user gets the value inside the key is the same, no save cycle, he will always save, usually used as a version number
Assignment value: application["key"]= value;
Value: Application.get ("key");
Command operation for Repeater:
- ItemCommand Event--all the controls that can trigger an event in repeater will trigger this event
- commandname--Judging what button is clicked, E.commandname
- commandargument--the primary key value data passed by the triggering event, which is placed in a single quotation mark E when bound at the face value.
- ItemCreated-the event is executed once the HTML code is generated in the item template
- ItemDataBound-Item Template performs this event once data is bound
Example:
<ItemTemplate> <tr class= "Tr_item" style= "<% #Eval (" Blue ")%>" > <td> ; <% #Eval ("UserName")%></td> <td><% #Eval ("Password")%></td> & lt;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= "remove" commandname= "delete" commandargument= ' <% #Eval ("UserName")%> '/> & Lt;asp:button id= "Button2" runat= "Server" text= "Modify" 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 (); }
Webform built-in Object Session object, application global object, ViewState