日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ScriptManager调用 无参数WebService

發(fā)布時(shí)間:2025/5/22 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ScriptManager调用 无参数WebService 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

在工程中添加一個(gè) webservice 使用默認(rèn)的

紅色部分為后添加

為了要讓ScriptManager識別這個(gè)WEBSERVICE

WebService.cs

using System;using System.Web;using System.Collections;using System.Web.Services;using System.Web.Services.Protocols;??/// <summary>/// WebService 的摘要說明/// </summary>[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]public class WebService : System.Web.Services.WebService {? public WebService () {? //如果使用設(shè)計(jì)的組件,請取消注釋以下行 //InitializeComponent(); }? [WebMethod] public string HelloWorld() { return "Hello World"; } }??寫好后在 ASPX中寫入 腳本代碼? <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>?<!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>無標(biāo)題頁</title> <script type ="text/javascript" > function RefService() { WebService.HelloWorld(GetResult); } function GetResult(result) { alert(result); } </script> </head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> <asp:ServiceReference Path="WebService.asmx"/> </Services> </asp:ScriptManager> <input type="button" value="abc" onclick="RefService()" /> </div> </form></body></html>

這個(gè)為添加的  

<Services> <asp:ServiceReference Path="WebService.asmx"/> </Services>

然后 添加一個(gè) Button 調(diào)用 一下 RefService() 方法

一個(gè) 調(diào)用 無參數(shù)WebService的 例子 現(xiàn)身

轉(zhuǎn)載于:https://www.cnblogs.com/zbqy/archive/2007/05/27/761485.html

總結(jié)

以上是生活随笔為你收集整理的ScriptManager调用 无参数WebService的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。