Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2011, 09:53 PM
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default PageMethods refuse to work correctly

The code bellow is all I have in a test project (ASP.NET 4.0 + VB) to test the usage of PageMethods:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication2._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="True" runat="server">
</asp:ScriptManager>
<div>
<input id="YourName" type="text" />
<br />
<input id="Button1" type="button" value="Say Hello now" />


<script language="javascript" type="text/javascript">
function HelloWorldC(result)
{
alert(result);
}

function HelloWorldPageMethod()
{
var yourName = $get('YourName').value;
pagemethods.HelloWorld(yourName, HelloWorldC);
}

function HelloWorldCallback(result)
{
alert(result);
}

$addHandler($get('Button1'), 'click', HelloWorldPageMethod);

</script>

</div>
</form>
</body>
</html>

The Config.Web contains:

<?xml version="1.0"?>

<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
</configuration>


Problem is: it looks like the compiler cannot get a reference to pagemethods. It does not shows in IntelliSence and when I run the application I only receive an erro that says "pagemethods" is not defined.

Any clues?





Similar Threads
Thread Thread Starter Forum Replies Last Post
SMS API does not work online but work fine offline. Tonik Beginning PHP 1 January 4th, 2013 08:30 AM
stylesheet not loading correctly BananaMan General .NET 0 September 30th, 2006 08:25 AM
Starting Off Correctly... JESwan XML 0 April 28th, 2005 08:01 AM
Why the form refuse access? shenliujun Javascript How-To 2 March 17th, 2005 04:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.