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();
......
@import url(“layout.css”)
CSS Selectors: *, p, div span, div > span, *[href], li+li, .title, #container, #title p:first-child, a:link, a:hover, a:visited, p:before, p:after
p:after{content:’url(images/quote.gif)’}
!important State Mode: Off, InProc, StateServer, SQLServer, C ......
页面代码:
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManage ......
如果测试的url地址是http : //www.test.com/testweb/default.aspx, 结果如下:
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PhysicalApplicationPath: E:\WWW\testwebReq ......
最近做保存远程图片时候,就在保存的时候总是出这个错误,网上google了一圈,都是再说权限问题,问题我是用U盘,哪里有什么权限问题。
最后无意中发现了问题所在
保存的时候不能用相对路径,一定要用server.mappath()处理一下保存的路径。。。唉! ......