Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Not getting return value on callback

$
0
0

I'm trying to use a callback to execute a query to count records based on a date and use a confirm to delete them. Everything is fine but for some reason, even though I cancel, a postback occurs anyway. I'm new to asynchronous callbacks so I'm not exactly sure how this is supposed to work given the different ways I've seen to do it. All the return values are correct in the script. There is a master page involved with most of the scripts being on that page because they are shared. This script is located at the bottom of the local page.

<script type="text/javascript" language="javascript">

	function checkRollOff() {

		PageMethods.PriorGigsInTable(onSuccess, onFailure);

		function onSuccess(result) {

			var retVal;

			if (result == true) {
				retVal = confirm("This will delete all gigs prior to the current date. Are you sure you want to do this?");
			}
			else {
				alert("There are no past gigs on the schedule...");
				retVal = false;
			}
			return retVal;

		}

		function onFailure(error) {
			alert(error);
		}

	}

</script>



[WebMethod]
public static bool PriorGigsInTable()
{
	//Return value based on successful operation
	if (ScheduleDataAccess.PriorGigsInTable())
		return true;
	else
		return false;

}

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>