2
我有下面的代碼,並試圖訪問lnkSave_Click函數中的'文本'字符串,但文本似乎不能從lnkSave_Click函數訪問,它似乎總是空的。c#公共字符串傳遞到函數
private string _text = "";
public string text
{
get { return _text; }
set { _text = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
text = "Hello World!";
}
}
protected void lnkSave_Click(object sender, EventArgs e)
{
if (text == "Hello World!")
{
... do things..
}
}