看看我的效果,或者程序有什么问题?帮帮忙
using System;using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication3
{
public partial class _Default : System.Web.UI.Page
{
public class car
{
private string color;
private int chelun = 4;
public string Color
{
get
{
return color;
}
set
{
color = value;
}
}
public int Chelun
{
get
{
return chelun;
}
}
public string Getinfo(string a, string b)
{
string c = "";
switch (a)
{
case "#red":
c +="#你的车子是红颜色的,共有" + b + "轮子!";
break;
case "#black":
c += "你的车子是黑颜色的,共有" + b + "轮子!";
break;
case "#white":
c += "你的车子是白颜色的,共有" + b + "轮子!";
break;
}
return c;
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
car NewCar = new car();
NewCar.Color = DropDownList1.SelectedValue.ToString();
string bb = NewCar.Color.ToString();
string cc = NewCar.Chelun.ToString();
string dd = NewCar.Getinfo(bb, cc);
Response.Write(dd);
}
}
}
目的是:当点击下拉表的时,显示上面的车颜色的提示...
我找了好长时间,也没找出来,请高手指点!