可以这么写吧?为什么进不了switch里面呢?我跟踪catalog得到的字符串就是这三个中的一个 啊,但就是都进不去
string catalog = Request.Params["Catalog"].ToString();
string productID = Request.Params["ProductID"];
//Response.Write(catalog);
switch (catalog)
{
case "News":
Server.Transfer("NewsInfo.aspx");
break;
case "Movie":
if (Request.Params["ProductID"] != null)
{
BindProductData(productID, catalog);
}
break;
case "Music":
Server.Transfer("MusicInfo.aspx");
break;
default:
break;
}
string catalog = Request.Params["Catalog"].ToString();
string productID = Request.Params["ProductID"];
//Response.Write(catalog);
switch (catalog)
{
case "News":
Server.Transfer("NewsInfo.aspx");
break;
case "Movie":
if (Request.Params["ProductID"] != null)
{
BindProductData(productID, catalog);
}
break;
case "Music":
Server.Transfer("MusicInfo.aspx");
break;
default:
break;
}
建议使用:
string product = Request.Params["ProductID"].Trim();
switch (catalog.Trim())
{
case "News":
Server.Transfer("NewsInfo.aspx");
break;
case "Movie":
if (Request.Params["ProductID"] != null)
{
BindProductData(productID, catalog);
}
break;
case "Music":
Server.Transfer("MusicInfo.aspx");
break;
default:
break;
}