Session
Each computer accesses the server and has an independent session, the key values are the same, and the contents are different.
1.session is saved on the server.
2. The session has no persistence and the storage period is 20 minutes.
Key points: Don’t abuse the session, don’t use it. Abuse will cause server overflow, and do not use it will cause resource waste.
Assignment: Session[key] = value;
Value: string a = Session[key];
Clear: Session[key]=null;
Application
Application[key] is that all users get the value in this key. There is no saving cycle, and it will be saved all the time, usually used as the version number.
Assignment: Application[key]=value;
Value: Application.Get(key);
Repeater's Command Operation:
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 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 it can help you understand. Thank you for your support for this website in this part!