Enter Movie Id :
OnClientClick i am calling a javacript function
function OnGetMovieDetailByMovieId()
{
var movieId = document.getElementById('<%= txtMovieId.ClientID %>').value;
MovieService.GetMovieDetailByMovieId(movieId, OnGetMovieDetailByMovieIdComplete, OnError)
}
and this function is calling Ajax-enable WCF service method from MovieService.
I have also defiend both callback function but when i click on button its get data from wcf web service and page again refresh and I lost data on page.
So why page is refreshing while i have only onclientclick of button.
Please suggest.
Thanks
Sandeep


Sukesh MarlaRank #461 · 5.4K reputationPosted Sep 30, 2012, 10:03 AM EDT
function OnGetMovieDetailByMovieId()
{
var movieId = document.getElementById('<%= txtMovieId.ClientID %>').value;
MovieService.GetMovieDetailByMovieId(movieId, OnGetMovieDetailByMovieIdComplete, OnError)
return false;
}
Check this is correct answer if it helped/
Shivanand ArurRank #920 · 2.3K reputationPosted Sep 30, 2012, 5:33 AM EDT
{
var movieId = document.getElementById('<%= txtMovieId.ClientID %>').value;
MovieService.GetMovieDetailByMovieId(movieId, OnGetMovieDetailByMovieIdComplete, OnError)
return false;
}
Try adding the script which is bold in your function...
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Sep 30, 2012, 7:55 AM EDT
I have implemented this but its not working means page is refreshing.
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Sep 30, 2012, 5:41 PM EDT
Sukesh MarlaRank #461 · 5.4K reputationPosted Sep 30, 2012, 9:52 PM EDT
if you notice i have written return false in button.onclientClick , which notifies Browser not to postback.
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Sep 30, 2012, 10:23 PM EDT
Krishna GaradRank #191 · 12.8K reputationPosted Oct 1, 2012, 1:12 AM EDT