开发者

Right way to show div with ASP.NET server controls

开发者 https://www.devze.com 2023-01-31 10:27 出处:网络
I have hidden div with ASP.NET server buttons. I show a content of that div as modal 开发者_JS百科window on the page via JavaScript by copying innerHTML, but buttons on that div don\'t fire server eve

I have hidden div with ASP.NET server buttons. I show a content of that div as modal 开发者_JS百科window on the page via JavaScript by copying innerHTML, but buttons on that div don't fire server events. Who knows how to fix that?

Thanks


A first guess would be that the innerHtml isn't a complete copy of the code needed to fire the events.

Maybe clone the node instead?


Make sure your hidden div is inside the <asp:Form></asp:Form> tag block.


there is much code.

Example is:

 <div id='divHidden' style='display:none'> <div id='divcontentToShow'>
 <!-- here is asp.net button -->
 <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" />
 </div> </div>

So, btnSubmit_Click event on the server doesn't fire when content of divcontentToShow copied to other div neither by appendChild nor innerHTML way.

0

精彩评论

暂无评论...
验证码 换一张
取 消