【发布时间】:2013-03-20 10:55:42
【问题描述】:
我有一个网络用户控件,我想从中调用网络服务。我的主要动机是什么:
1.我正在为高级搜索创建一个网络用户控件,为此我将绑定的字段和按钮[编辑,删除]动态添加到网格视图。 2. 现在我正在使用 ajax 进行编辑和删除(有特定的理由采用这种方法,因为我已经提到我正在动态添加边界字段和按钮,因为首先我清除了网格的所有列然后添加新的。现在如果按钮的点击触发,那么它的回发页面,这使得按钮将从网格中消失,所以我想使用 Json)
这是我的网格代码::
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CellPadding="4"
BorderWidth="1px" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
<HeaderStyle Height="30px" BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#333333" HorizontalAlign="Center" BackColor="#E2E2E2" />
<RowStyle CssClass="test" BackColor="#E2E2E2" Height="25px" BorderWidth="1px" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2E2E2" Font-Bold="True" ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="#FDF5AC" />
<SortedAscendingHeaderStyle BackColor="#4D0000" />
<SortedDescendingCellStyle BackColor="#FCF6C0" />
<SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
这是Json调用的代码
$('.DeleteButton').live('click', function () {
alert('hellllo');
$.ajax({
url: '<%=ResolveUrl("~/Control/WebService/WebService.asmx/HelloWorld") %>',
data: "{ }",
dataType: "json",
type: "POST",
contentType: "application/json;charset=utf-8",
success: function () {
alert('hi;');
},
error: function () {
alert('Record could not be deleted. \n Please try again later. hye');
},
failure: function () {
alert('Record could not be deleted. \n Please try again later. hello');
}
});
});
我总是收到以下错误:
500 个内部错误 请帮助我摆脱这个问题,我从过去 2 天开始就被困住了。
【问题讨论】:
-
500 表示错误在你的服务中。
-
@Schaliasos 什么样的错误,我该如何解决
-
是
Internal Server Error,正如您在其描述中看到的那样。您需要以某种方式找出您的服务出了什么问题。您使用日志记录吗? -
检查您的网址内容,将其替换为另一个示例工作网址并检查是否成功!深入研究
-
@codebrain 我已经检查过它是否创建了正确的路径并在另一个页面中工作
标签: c# asp.net json web-services webusercontrol