[英]How to user javascript with asp.net viewstate
I have UL in my page, and it is empty. 我的页面中有UL,而且它是空的。 I start populating it with LI using javascript. 我开始用LI使用javascript填充它。
How can I use this newly added dynamic data in the asp.net in the postback phase? 如何在回发阶段在asp.net中使用这个新添加的动态数据?
that is because my submit button is asp.net control. 那是因为我的提交按钮是asp.net控件。 I do not want to use JS POST. 我不想使用JS POST。
thanks 谢谢
LI is not transferred over POST. LI不通过POST转移。 Only elements of form: INPUT (text, hidden...), OPTIONS, are passed. 只传递表单元素:INPUT(text,hidden ...),OPTIONS。 So the simplest way is create hidden field 所以最简单的方法是创建隐藏字段
<input type='hidden' name='myData' id='myData' ...
and at ASP.net side access just created control by 并在ASP.net端访问刚刚创建的控件
HttpRequest request = HttpContext.Current.Request;
String value = request.Form["myData"]
I've done this sort of thing in the past by populating a hidden field with the dynamic data to be posted back, you could either - 我过去做过这种事情,通过填充隐藏的字段来回发动态数据,你可以 -
or 要么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.