62,272
社区成员
发帖
与我相关
我的任务
分享
<input name="txtInput" id="txtInput" />
<script>
document.getElementById("txtInput").value = '<%=dicClient.ContainsKey("txtInput")?dicClient["txtInput"]:""%>'
</script>
<input name="txtInput" value='<%= dicClient.ContainsKey("txtInput")?dicClient["txtInput"]:""%>' />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
public Dictionary<string, object> dicClient = new Dictionary<string, object>();
protected void Button1_Click(object sender, EventArgs e)
{
if (!dicClient.ContainsKey("txtInput"))
dicClient.Add("txtInput", Request.Form["txtInput"]);
else
{
dicClient.Remove("txtInput");
dicClient.Add("txtInput", Request.Form["txtInput"]);
}
}
<input name="txtInput" value='<%= txtInput%>' />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
public string txtInput;
protected void Button1_Click(object sender, EventArgs e)
{
txtInput = Request.Form["txtInput"];
}