asp.net在用ajax的时候如何弹出对话框
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:updatepanel ID="UP" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="Button" onclick="Unnamed2_Click" />
</ContentTemplate>
</asp:updatepanel>
</div>
</form>
ASP.NET2.0中AJAX使用新的Manager 类来管理,而不兼容原来的 ClientManager 类 ,所以用response.write("<script>alert('提示:点我了!')</script>")和
this.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('提示:点我了!');</>", true);
Page.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('提示:点我了!);</>", true);
这些方法都是无效的.
可以用以下方法写代码实现
ScriptManager.RegisterStartupScript(UP, UP.GetType(), "", "alert('点我了');", true);
这样就可以实现了!
//UP是updatepanel 的ID
转自http://www.csharp360.com/bbs/viewthread.php?tid=233&extra=
相关文档:
ajax Detail.aspx页面
protected void Page_Load(object sender, EventArgs e)
{
Thread.Sleep(500);
string Keyid = Request.QueryString["Id"].ToString();
......
<html>
<body>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Inte ......
好久不碰WEB的东东了,最近学习SAP的BSP技术,又用到这些,顺便转篇文章,备查.
原文地址: http://www.ibm.com/developerworks/cn/xml/x-ajaxxml2/
Ajax 和 XML:
五
种常见 Ajax 模式
可立即使用这些非常有用的 Ajax 设计模式
文档选项
<tr valign="top"><td width="8">< ......
/*在有中文参数时,接收方需要使用UTF-8方式对数据进行解码
*不支持post附件
*/
function getXmlHttpRequest() {
var xmlHttpRequest = null;
try {
xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} ......
在本节我准备只写上关于Ajax的说明,多数来自jQuery的帮助文档,所以不要放在首页。因为我觉得首页应该是要花费了时间和心思的作品。代码演示和jQuery Ajax 一些新的,将在下一次有空时讲述,这里就不讲了。时间已经0晨了。如果你举得有什么jQuery的疑问或者觉得Ajax该讲述那些内容的都可以跟我留 ......