c# - performing .net postback on jquery ui tab selection -
i have set of tabs on web form using jqueryui tabs.
when click on tab, want data on tab load (only when click on tab). don't want load tab data on initial page load.
i have used linkbutton on tab, when click on tab, button click event should fire , cause post back. not happen.
my question is. jqueryui tab pluggin disable default action of link in tab? noticed if don't use anchor link of sort in tab li element tab not rendered properly, jquery requires anchor render.
how can data load when tab selected?
http://jqueryui.com/tabs/#ajax
content via ajax in right hand menu
then can like
ajaxpostback.ashx?page=page1
and returning intended content
code example
javascript
<script type="text/javascript"> $(function () { $("#tabs").tabs(); });
html
<div id="tabs"> <ul> <li><a href="#tabs-1">preloaded</a></li> <li><a href="handler1.ashx?page=1">tab 1</a></li> <li><a href="handler1.ashx?page=2">tab 2</a></li> <li><a href="handler1.ashx?page=3">tab 3 (slow)</a></li> <li><a href="handler1.ashx?page=4">tab 4 (broken)</a></li> </ul> <div id="tabs-1"> <p> nunc tristique tempus lectus.</p> </div>
handler
public void processrequest(httpcontext context) { if (string.compare(context.request.querystring["page"].tostring(), "1") == 0) { context.response.contenttype = "text/plain"; context.response.write("1"); } else if (string.compare(context.request.querystring["page"].tostring(), "2") == 0) { context.response.contenttype = "text/plain"; context.response.write("2"); } else { context.response.contenttype = "text/plain"; context.response.write("rest"); } }
Comments
Post a Comment