日期:2008-03-01  浏览次数:20485 次

Aiyiweb.Com提示:这里一定要添加WEB 援用菜单步骤如下project->add web reference...,然后输入我们Web Service的路径,这里是http://localhost/WebService1/Service1.asmx,点击添加就OK了。这时你将在类视图中看到localhost命名空间了。

这里一定要添加WEB 援用菜单步骤如下project->add web reference...,然后输入我们Web Service的路径,这里是http://localhost/WebService1/Service1.asmx,点击添加就OK了。这时你将在类视图中看到localhost命名空间了。

WebApplication1
WebForm1.aspx  
代码:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:Panel id="Panel1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 16px" runat="server"
                Width="568px" Height="256px">
                <P>Panel
                    <asp:Button id="Button3" runat="server" Text="Button3"></asp:Button>
                    <asp:Button id="Button2" runat="server" Text="Button2"></asp:Button>
                    <asp:Button id="Button1" runat="server" Text="Button1"></asp:Button>
                    <asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
                <P>
                    <asp:Label id="Label1" runat="server">Label</asp:Label></P>
                <P>
                    <asp:DataGrid id="DataGrid1" runat="server" Width="568px" Height="120px"></asp:DataGrid></P>