首先,我知道這個問題看起來非常相似的問題here名稱「txtinput1」不在當前情況下存在
但是不知怎麼的修正建議;隨行爲我工作。所以在這裏。 我有下面的代碼 在我的aspx頁面:
<asp:TextBox ID="txtinput1" runat="server" Width="200px"
ontextchanged="txtinput1_TextChanged"></asp:TextBox>
但是當我嘗試下面的代碼在我後面的代碼:
protected void Page_Load(object sender, EventArgs e)
{
StemService.ServiceClient myClient = new StemService.ServiceClient();
string input = txtinput1.Text;
}
我得到的錯誤,說「txtinput1」不存在在上下文中。 爲了完成這裏是我的default.aspx https://gist.github.com/KodeSeeker/5217410。
P.S.我是C#noob,所以我可能會失去一些明顯的東西。
編輯:Designer.cs https://gist.github.com/KodeSeeker/5217484
編輯2:Default.aspx.cs:https://gist.github.com/KodeSeeker/5217517
檢查設計師的正確申報.cs文件以查看是否已添加... – 2013-03-21 22:37:48
請檢查編輯。它似乎存在於其中。 – KodeSeeker 2013-03-21 22:41:51
你也可以添加.cs文件嗎? – 2013-03-21 22:44:45