?? rating.aspx.cs
字號:
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
using System;
using System.Threading;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
public partial class Rating_Rating : CommonPage
{
/// <summary>
/// Set the alignment of the stars in the rating control
/// </summary>
/// <param name="e">argument</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
ThaiRating.RatingAlign = (lstAlign.SelectedIndex == 1) ?
Orientation.Vertical :
Orientation.Horizontal;
ThaiRating.RatingDirection = (lstDirection.SelectedIndex == 1) ?
RatingDirection.RightToLeftBottomToTop :
RatingDirection.LeftToRightTopToBottom;
}
/// <summary>
/// Updates the label with how spicy the user likes their Thai food
/// </summary>
/// <param name="sender">source</param>
/// <param name="e">argument</param>
protected void Submit_Click(object sender, EventArgs e)
{
string howSpicy = "[unknown]";
switch (ThaiRating.CurrentRating)
{
case 1 :
howSpicy = "bland";
break;
case 2 :
howSpicy = "mild";
break;
case 3 :
howSpicy = "spicy";
break;
case 4:
howSpicy = "scorching hot";
break;
case 5:
howSpicy = "tongue melting";
break;
}
lblResponse.Text = "You prefer Thai food that is <b>" + howSpicy + "</b>.";
}
/// <summary>
/// Run custom code when the user rates something and then return a custom string
/// to the JavaScript client
/// </summary>
/// <param name="sender">Rating control</param>
/// <param name="e">RatingEventArgs</param>
protected void ThaiRating_Changed(object sender, RatingEventArgs e)
{
Thread.Sleep(400);
e.CallbackResult = "Update done. Value = " + e.Value + " Tag = " + e.Tag;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -