showModalDialog 網頁做送出動作 (Submit/PostBack)

JavaScript 的window.showModalDialog語法,在網頁做送出動作(如Submit/PostBack)時,會另開新視窗,解決的方式是將 <base target=”_self”>加入<head>~</head>中間。

ASP.Net的寫法:

1、有MasterPage:
Page.Header.Controls.Add(new LiteralControl(@”<base target=””_self”” />“));

2、無MasterPage:
[ in the .cs page ]
protected string baseUrl = “<base href=\”_self\”>“;
[ in the .aspx page ]

<head>
<%= baseUrl %>
</head>

 

 

by mhchen15 on 29 3 月, 2012 in ASP.NET C#, Javascript, 程式 - Tags: ,
Tags: ,

There are no comments.

Name*: Website: E-Mail*:
XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>