I am loading an aspx page into a div using jquery.load(开发者_运维百科). The aspx page loaded into the div has a datalist. Each datalist item has a linkbutton. My problem is that the linkbutton is not causing a postback though. Strangely, if I change the linkbutton to a button, it does postback. Also, when loading the page normally (not from a jquery.load event), the linkbutton performs correctly.
What is it that causes the linkbutton to not cause a postback when loaded this way? And is there a better way to handle this?
Thanks in advance,
IUJPJ
LinkButton renders a __doPostBack() JS method call, whereas a Button renders a submit button by default.
When replacing the UI with JQuery.load, scripts inside the content do not automatically parse and run. That's probably the issue here.
HTH.
+1 on what Brian said. Is there a better way to handle it? I can think of a couple of ways:
convert the postback events to a handler. Then you can wire your dynamically loaded linkbuttons to regular links and use jquery ajax to post to your handler.
You could load your aspx page as an iframe
I think the 1st option is more elegant but requires more work.
精彩评论