我在我的HTML div元素,奇怪的問題與asp.net C#分配字符串
<div id="userSolution" runat="server" text="1234512345123451234512345"></div>
是的,它確實包含25個字符,
我有一個按鈕:
<asp:Button id="saveGame" runat="server" text="Save Game" onclick="saveGame_Click" />
服務器代碼:
protected void saveGame_Click(object sender, EventArgs e)
{
string clientInput = userSolution.Attributes["text"];
}
所以爲什麼......當我調試時,clientInput
=「」?
我估計...... text="1234512345123451234512345"
所以string clientInput= userSolution.Attribute["text"];
應該工作的權利? :■
迷茫......
即使DIV是:
<div id="userSolution" runat="server">1234512345123451234512345</div>
和我讀
string clientId = userSolution.InnerHTML;
仍未
號div元素從未有過的文本屬性。 – BoltClock 2011-05-24 19:43:09
即使我從innerHTML中讀取它,並使我的文本值div div innerhtml的一部分...仍然失敗 – 2011-05-24 19:48:02
innerText怎麼樣? – 2011-05-24 19:51:59