web 2.0

ASP.NET(vb.net) & ScriptManagerProxy

ASP.NET(vb.net) & ScriptManagerProxy - Enables nested components such as content pages and user controls to add script and service references to pages when a ScriptManager control is already defined in a parent element.

ShotDev Focus:
- ASP.NET(vb.net) & ScriptManagerProxy

ASP.NET(vb.net) & ScriptManagerProxy

Example

SimpleService.asmx

<%@ WebService Language="VB" CodeBehind="~/App_Code/SimpleService.vb" Class="SimpleService" %>

App_Code/SimpleService.vb

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class SimpleService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld(ByVal args As String) As String
Return "Hello : " + args
End Function
End Class

ScriptManagerProxy.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ScriptManagerProxy.aspx.vb" Inherits="ScriptManagerProxy" %>

<!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 id="Head1" runat="server">
<title>ShotDev.Com Tutorial</title>
</head>
<script language="javascript" type="text/javascript">
<!--

function Button1_onclick() {
reqviaprovy = SimpleService.HelloWorld(
document.getElementById('Text1').value,
OnComplete,
OnTimeout);
return false;
}

function OnComplete(results)
{
alert(results);
}
function OnTimeout(results)
{
alert("Timout");
}

// -->
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" id="UpdatePanel1">
<ContentTemplate>
<asp:ScriptManagerProxy id="ScriptManagerProxy1" runat="server">
<Services>
<asp:ServiceReference Path ="SimpleService.asmx" />
</Services>
</asp:ScriptManagerProxy>
<br />
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

ScriptManagerProxy.aspx.vb


Partial Class ScriptManagerProxy
Inherits System.Web.UI.Page

End Class

Screenshot

ASP.NET(vb.net) & ScriptManagerProxy
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.