各位大侠 帮我看看 问题怎样解决 ?感激不尽啊——来自一个大学才开始碰电脑学电脑的学生!
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;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public enum SearchType
{
NotSet=-1,
Products=0,
Category=1
}
protected void radioButton_CheckdChanged(object sender, EventArgs e)
{
if (RadioButton1.Checked)
{
MultiView1.ActiveViewIndex = (int)SearchType.Products;
}
else if(RadioButton2.Checked)
{
MultiView1.ActiveViewIndex = (int)SearchType.Category;
}
}
protected void buttonSearch_Click(object sender, EventArgs e)
{
if (MultiView1.ActiveViewIndex > -1)
{
string searchTerm = "";
SearchType mSerchType = (SearchType)MultiView1.ActiveViewIndex;
switch (mSearchType)
{
case SearchType .Products:
DoSearch(TextBox1.Text,mSearchType);
break;
case SearchType.Category:
DoSearch(TextBox2.Text, mSearchType);
case SearchType.NotSet:
break;
}
}
}
protected void DoSearch(object sender, EventArgs e)
{
string results = "你在查询{0}for{1}.";
Label1.Text = string.Format(results,searchTerm);
}
}
/*错误 1 当前上下文中不存在名称“mSearchType” E:\Documents\Visual Studio 2008\WebSites\WebSite2\Default2.aspx.cs 43 21 E:\...\WebSite2\
错误 2 当前上下文中不存在名称“mSearchType” E:\Documents\Visual Studio 2008\WebSites\WebSite2\Default2.aspx.cs 46 44 E:\...\WebSite2\
错误 3 当前上下文中不存在名称“mSearchType” E:\Documents\Visual Studio 2008\WebSites\WebSite2\Default2.aspx.cs 49 45 E:\...\WebSite2\
错误 4 当前上下文中不存在名称“searchTerm” E:\Documents\Visual Studio 2008\WebSites\WebSite2\Default2.aspx.cs 58 45 E:\...\WebSite2\
*/