Reputation: 30313
in my application i have the playvideo page where video will play, below that i have the option for sharing the video like adding to favorite ,playlist and sending mail. when i click on any of the link the page is postbacking and video will start from the first. i place update panel for link button even though it is not working (video is playing from the first i.e., page is postbacking. can u help me. thank you
Upvotes: 3
Views: 1900
Reputation: 9986
Actually, the part of page that is within the UpdatePanel
does the postback. Make sure you have only those controls(for instance, your links) inside the UpdatePanel
.
Alternatively, you can use multiple UpdatePanel
s; for instance one for your video and one for the links. In this case note that, when one UpdatePanel
gets updated other UpdatePanel
s also gets updated, which you may not want; so all you have to do then is to mark the UpdateMode
property to Conditional
and call YourDesiredUpdatePanel.Update()
method manually - whenever required.
Btw, updating selected portions of the page also reduces the load on the server
Or you may want to look into using client callbacks instead of a postback. But since client callback uses XMLHTTP, which means Microsoft implementation of AJAX, therefore callbacks are just awesome as long as your are working with IE.
Upvotes: 2
Reputation: 10254
You might want to try taking advantage of Page Methods to do the work you need done server side.
http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
Also, if you want to prevent a control from posting back, you can add return false to the end of your javascript onclick event on the control.
For example, if you had an asp button you were using you could do this:
<asp:Button ID="myButton" runat="server" OnClientClick="DoThingsInJavascript(); return false;" />
Or if you were just using a standard button you could say:
<input type="button" onclick="DoThingsInJavascript(); return false;" />
Upvotes: 2
Reputation: 4886
I've never really liked the update panel and I have sometimes found it's behaviour awful. Have you thought of trying something like a proper ajax call from Javascript
Upvotes: 0