带有Ajax示例的Asp.net [英] Asp.net with ajax example
问题描述
我尝试了一个简单的Asp.net Ajax示例.它在.net框架内工作.我将文件和用户界面后面的代码合并到一个页面中.它不起作用.请帮助我.我在此处附加了编码..
<%@页面语言="VB" debug ="true"; %>
<%@寄存器程序集="System.Web.Extensions,版本= 1.0.61025.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35"命名空间="System.Web.UI"; TagPrefix ="asp". %>
<!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 =服务器">
< script language ="javascript''>
var XMLHttpRequestObject = false;
if(window.XMLHttpRequest)
{
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
</script>
</head>
< body>
< form id ="form1" runat =服务器">
<脚本语言="VB" runat =服务器">
受保护的子Button1_Click(ByVal发送者作为对象,ByVal e作为System.EventArgs)处理Button1.Click
.Label1.Text =您单击了按钮!" br/>结束子
</script>
< asp:ScriptManager EnablePartialRendering ="true"; ID ="ScriptManager1"; runat =服务器"></asp:ScriptManager>
.< div>
< asp:UpdatePanel ID ="UpdatePanel1"; runat =服务器"
< ContentTemplate>
< asp:Label ID ="Label1" runat =服务器"文字=这是一个标签!"</asp:标签<< asp:Button ID ="Button1" runat =服务器"文字=点击我" OnClick =" Button1_Click"; />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
I tried a simple Asp.net ajax example. Its work within the .net framework. i merge the code behind file and user interface in a single page. It doesn't work. pls help me. I attached the coding here..
<%@ Page Language="VB" debug="true" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<!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>Untitled Page</title>
<script language="javascript">
var XMLHttpRequestObject=false;
if(window.XMLHttpRequest)
{
XMLHttpRequestObject=new XMLHttpRequest;
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<script language="VB" runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "You clicked the button!"
End Sub
</script>
<asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="This is a label!"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Click Me" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
推荐答案
在
Try over at http://forums.asp.net
And you can use the intrinsic ASP.NET ajax objects rather than using XMLHTTP objects
这篇关于带有Ajax示例的Asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!