Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0call webservice method using script managercall webservice method using script manager
Previous
 
Next
New Post
11/20/2008 2:30 PM
 

Hello,

I was looking at the below thread and trying to call a webservice webmethod using client side script and I get javascript error like namespace is not defined. I assume the script manager is not generating the proxy class on the client side. Could anyone please look at my code and point out what is wrong.

http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/111/threadid/257191/scope/posts/Default.aspx

.ASCX

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ImageViewer.ascx.vb" Inherits="Accretive.Controls.Tasks.Remittance.ImageViewer" %>
<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI" tagprefix="asp" %>

<br /><br /><br />
Enter name : <input type="text" id="txtName" />
<br /><br /><br />
<input type="button" id="btnSave" value="Click Me" onclick="Getmyname()" />

.VB

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim objScriptManager As ScriptManager
            Dim objServiceReference As ServiceReference

            If DotNetNuke.Framework.AJAX.IsInstalled Then
                objScriptManager = ScriptManager.GetCurrent(Me.Page)
                objServiceReference = New ServiceReference
                objServiceReference.Path = ResolveUrl("LockBoxImage.asmx")
                objScriptManager.Services.Add(objServiceReference)
            End If

            Dim cscrpt As String = "function Getmyname()" & _
                                    "{" & _
                                    "   var name = $get(""txtName"").value;" & _
                                    "   Accretive.Controls.Tasks.Remittance.LockBoxImage.Getmyname(name, OnSuccess, OnFailed);" & _
                                    "}" & _
                                    "function OnSuccess(Result) {" & _
                                    "   Result);" & _
                                    "}" & _
                                    "function OnFailed(error) {" & _
                                    "   error.get_message());" & _
                                    "}" & _
                                    "function Popmsg() {" & _
                                    "   it works now!');" & _
                                    "}"

            ScriptManager.RegisterClientScriptBlock(Me.Page, Page.GetType(), "wsspt", cscrpt, True)
        End Sub

.ASMX

Imports System.Web.Services

Namespace Accretive.Controls.Tasks.Remittance

    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    <System.Web.Script.Services.ScriptService()> _
    <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
    <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <ToolboxItem(False)> _
    Public Class LockBoxImage
        Inherits System.Web.Services.WebService

        <WebMethod()> _
        Public Function Getmyname(ByVal Nme As String) As String
            Return Nme & " you click at " & Date.Now.ToString
        End Function

    End Class

End Namespace

FYI, the webservice it located on the same folder and support partial rendering is enabled for this module. I am using script manager client script registration, since Page client registration was not working. When I click the button I get a javascript error as below.

Error: 'Accretive' is undefined.

Your help will be highly appreciated!

Thanks,

Vinoth

Report Post 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0call webservice method using script managercall webservice method using script manager


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out