Calling a Javascript/JQuery function on postback for ASP.NET/C# page -
i working jquery plugin called 'tab slide out' link here: http://wpaoli.building58.com/2009/09/jquery-tab-slide-out-plugin/
i trying use feedback technique. on slide out there form, , submit button. when hit submit, of course causes postback, , page loads, feedback window set closed state. want window automatically open on postback. here example of website uses plugin , has working how want work: http://thedemo.ca/
now noticed in there script have on initial page load:
jquery('.slide-out-div').tabslideout({ tabhandle: '.handle', pathtotabimage: 'typo3conf/ext/stw_jquery_feedback/images/feedback-btn-right.png', imagewidth: '32px', imageheight: '167px', tablocation: 'right', speed: 300, action: 'click', toppos: '200px', fixedposition: true, onloadslideout: false });
and on postback submit button:
jquery('.slide-out-div').tabslideout({ tabhandle: '.handle', pathtotabimage: 'typo3conf/ext/stw_jquery_feedback/images/feedback-btn-right.png', imagewidth: '32px', imageheight: '167px', tablocation: 'right', speed: 300, action: 'click', toppos: '200px', fixedposition: true, onloadslideout: true });
notice last option of onloadslideout
changes. how possible? said think simplest solution call click on tabhandle, in turn sliding out tab.
so guess real question is, how can call click .handle.
here link test environment of code: http://jakeism.info/test/
they rendering script dynamically. in asp.net simplest way in aspx/ascx like:
<script type="text/javascript"> jquery('.slide-out-div').tabslideout({ tabhandle: '.handle', pathtotabimage: 'typo3conf/ext/stw_jquery_feedback/images/feedback-btn-right.png', imagewidth: '32px', imageheight: '167px', tablocation: 'right', speed: 300, action: 'click', toppos: '200px', fixedposition: true, onloadslideout: <% response.write(page.ispostback ? "true" : "false") %> }); </script>
note scriptlet onloadslideout
. logic won't want -e.g. postback cause rendered open. substitute whatever appropriate condition.
a nicer way post webservice
using ajax, instead of posting whole page, don't have postback @ all. cleanly close slideout after letting user know feedback has been received.
Comments
Post a Comment