在 web應用中
比如有個數據庫表
[ScriptService]
public class InboxService : System
{
[WebMethod]
public int GetLatestNumberOfEmails()
{
int numberOfEmails =
using (SqlConnection conn = new SqlConnection(WebConfigurationManager
{
using (SqlCommand cmd = new SqlCommand(
{
cmd
conn
numberOfEmails = (int)cmd
}
}
return numberOfEmails;
}
}
這裡要注意要在客戶端通過AJAX調用WEBSERICE
<asp:UpdateProgress DynamicLayout=
<ProgressTemplate>
<div id=
<div class=
<div class=
<span style=
<img alt=
</span>
</div>
<div class=
You received <strong><span id=
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
這裡的關閉X按鈕
然後當然要加scriptmanager控件了
<asp:ScriptManager ID=
<Services>
<asp:ServiceReference Path=
</Services>
</asp:ScriptManager>
這裡調用了我們剛才寫的webservice
[
From:http://tw.wingwit.com/Article/program/net/201311/15318.html