1. Use session in a non-system. Web. UI. Page class
Object islogined = system. Web. httpcontext. Current. session ["islogined"];
If (islogined! = NULL)
{
}
2. Store a small amount of data in viewstate
Private int channelid
{
Get
{
If (webutils. getqueryint ("channelid", 0)> 0)
Viewstate ["channelid"] = webutils. getqueryint ("channelid", 0 );
Return utils. strtoint (viewstate ["channelid"], 1 );
}
Set
{
Viewstate ["channelid"] = value;
}
}
3. filter data in Dataset
Public dataset getpassedlist ()
{
Return this. getdataset ("[ispassed] = 1 order by [guestid] DESC ");
}
Filter in Dataset
Public dataset getpassedlist ()
{
Return this. getdataset ("[ispassed] = 1 order by [guestid] DESC ");
}
4. RMB format:
Decimal price;
Decimal discount;
Decimal discounted_price;
// Compute discounted price
Price = 19.95 m;
Discount = 0.15 m; // discount rate is 15%
Discounted_price = Price-(price * discount );
console. writeline ("discounted price: {0: c}", discounted_price);