📄 default.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Services;
using System.Collections.Specialized;
using AjaxControlToolkit;
public partial class _Default : System.Web.UI.Page
{
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
// Get selected values
string make = DropDownList1.SelectedItem.Text;
string model = DropDownList2.SelectedItem.Text;
string color = DropDownList3.SelectedItem.Text;
// Output result string based on which values are specified
if (string.IsNullOrEmpty(make))
{
Label1.Text = "Please select a make.";
}
else if (string.IsNullOrEmpty(model))
{
Label1.Text = "Please select a model.";
}
else if (string.IsNullOrEmpty(color))
{
Label1.Text = "Please select a color.";
}
else
{
Label1.Text = string.Format("You have chosen a {0} {1} {2}. Nice car!", color, make, model);
}
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static CascadingDropDownNameValue[] GetDropDownContentsPageMethod(string knownCategoryValues, string category)
{
return new CarsService().GetDropDownContents(knownCategoryValues, category);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -