I have a .net 3.5 aspx place with a method tagged with the [WebMethod] tag. I'm calling this with jQuery, sending JSON in both directions. This all works great. My question is, what does [ScriptMethod] do when applied to a function? I've tried this and it seems to yield the same result. Are ScriptMethods and WebMethods identical and inte...
I am having a pagemethod to which i give a call from my JavaScript
say
Pagemethods.MyMethod(MyParameter, onsucess, onfailure);
In the Code behind, I have something like this:
[WebMethod]
public static void MyMethod(Param)
{
try{
//DoSomething..
}
catch(exception ex)
{
//Log the exception and rethrow
thr...
Here is a snippet of my html:
<input id="btnGetDate" type="submit" value="Get Date" />
<div id="Result"></div>
<script type="text/javascript">
$(document).ready(function() {
$("#btnGetDate").click(function() {
$.ajax({
type: "POST",
url: "Date.aspx/GetDate",
...
This has been asked before, but there was no really good answer, so I wanted to get some fresh thoughts on this.
I have a website using forms authentication. I have a page that uses page methods to perform various actions. The user is idle on the page past the timeout, then performs an action that calls the page method. When the page...
I am going crazy. I have tried dozens of examples and I have yet to get jquery to successfully return the results of a call to a pagemethod. I have copied each example, letter for letter, and pasted it into my web project to no avail. I am clearly missing something so obvious and stupid but what the heck is it?
I have tried examples on ...
Hi here I'm trying to call a [webmethod] on bodyunload method.
But it is getting fired on page load itself only. How do i prevent it?
Here's the code I am using:
[WebMethod]
public static void AbandonSession()
{
HttpContext.Current.Session.Abandon();
}
<script language="javascript" type="text/javascript">
//<![CDATA[
function H...
Hi!
I created a AutoCompleteExtender on a TextBox that resides on a UserControl (Control.ascx file).
I don't want to create a separate class for the web method, i rather placing it in the code file (Control.ascx.cs) itself.
Is there a way?
I have successfully tried once ago placing the method on the same page but it was a page, and i...
Given the following javascript code:
function ValidateFlagAsUrgent() {
selectedValuesList = document.getElementById('<%= _searchResultsUserControlUserControl.SelectedValuesHiddenFieldClientID %>').value;
$.ajax({
type: 'POST',
url: window.location.href + '/' + 'AreAnyOfTheSelectedTasksInMyProjects',
data: '{"selectedTasks"...
I have am using a sortable jQuery list. I would like to send the results of that list to a webmethod for processing.
So my javascript is something like:
function ProcessSortableList() {
var arr = {};
arr[0] = "item1";
arr[1] = "item2";
PageMethods.TestMe(arr);
}
I then have a webmethod on the server side:
[WebM...
I haven't started writing any code for this program, but here's what I need to do in C#/ASP.NET, both of which I'm just starting to learn.
I have a DIV on a page that I want to update with information from an MS SQL Server every five seconds.
Would it be better to create my countdown timer on the JavaScript or C# side?
Would UpdatePan...
I've seen lots of related questions, but nowhere have I found a simple example of code that passes parameters back to a page method via jquery.
I've looked through some of the examples at encosia.com (thanks, Dave) but still haven't managed to get it working. Here's the code so far:
Updated - added some code to pass in params, but it'...
I am using ASP.NET Page Methods for my application. Everything works like charm but I do not want my page methods generated inline in the page.
Is there any way to move them to a WebResource.axd file or something similar. I don't really want to write my own proxy just to move the generated one away from the page.
I have multiple page ...
My server side code:
[WebMethod(CacheDuration = 0, EnableSession = true)]
public static int UserID()
{
if (HttpContext.Current.Session["UserID"] == null) return 0;
int UserID = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
return (UserID);
}
My Client side code:
$.ajax({
type: "P...
Using jQuery, my client side is calling Vote from a page method. The signature of the webmethod is below.
[WebMethod]
public static string Vote(int selectedAnswer, int pollID, string userToken) {
... }
My question is in Vote(), how do I reference Page.Request so I can get the user's IP Address? In a normal page load meth...
I am generating a file on the server and I do not want to write it to disk but instead return it to the client via a web service. What recommendations would you have to do this?
...
I have a very simple call to a PageMethod. When I step through my PageMethod in my .cs file, the value looks as expected. However, on the client side I get an undefined result. Any ideas? This should be horribly simple.
Here is my js: (EnablePageMethods="true" in my ASPX page)
function test() {
alert(PageMethods.MyMethod("Joe Blow"...
how Call non-static method in server side(aspx.cs) from client side using javascript (aspx)....?
As far as I know I can call static method in server side from client side...
server side :
[System.Web.Services.WebMethod]
public static void method1()
{
}
client side :
<script language="JavaScript">
function keyUP()
{...
I am just starting to mess around with Page Methods and jQuery together with not much success.
Below is my sample code...
Default.aspx.cs
[WebMethod]
public static string test()
{
return "testing 123";
}
test.js
$(document).ready(function()
{
$("#Result").click(function()
{
$.ajax({
type: "POST",
...
I have an ASP.NET application running on two almost identical Virtual Windows Server 2003. The first one is my develop and test server. I have installed the .NET WebExtensions for Framework 2.0 there and the application runs well. Now I tried to publish the same application on a second server (lets call him the production server) and als...
I am building a dynamic partial load asp.net page, I would like to use jQuery to call page methods or web service to retrieve the content HTML.
page methods or web service, performance wise, which way is better?
If I call page method, on the server side, does the page go through full lifecycle?
Is there any good resources help me to b...