简体   繁体   English

在asp.net按钮发布后恢复动态创建的javascript表结构

[英]restore dynamically created javascript table structure after asp.net button post back

On runtime i am creating table structure using javascript and appending it to the div which is placed in an update panel. 在运行时,我正在使用javascript创建表结构,并将其附加到放置在更新面板中的div中。 Problem here is, when i use asp.net button control, onClick of the button it posts the page to server and whatever javascript tables i have created it goes off. 这里的问题是,当我使用asp.net按钮控件时,按钮的onClick会将页面发布到服务器,而我创建的任何javascript表都将关闭。 When i use html input button (input type="button") i don't face this problem and tables also stay there. 当我使用html输入按钮(输入类型=“ button”)时,我不会遇到此问题,并且表格也停留在该位置。 But i have to use asp.net button to take necessary actions on the server side. 但是我必须使用asp.net按钮在服务器端采取必要的措施。 Is there any way that i can restore the structure or use asp.net button control alongwith dynamic javascript. 有什么办法可以恢复结构或使用asp.net按钮控件以及动态javascript。 Any help would be appreciated. 任何帮助,将不胜感激。

Thanks. 谢谢。

You need to save your table structure in an Hidden field just before clicking/submitting on asp.net button. 在单击/提交asp.net按钮之前,您需要将表结构保存在“ Hidden字段中。 On Post back, you can redisplay that. 在回发上,您可以重新显示它。 The asp.net button has property OnClientClick , you can use this property. asp.net按钮具有属性OnClientClick ,您可以使用此属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM