asp.net中的“回发"按钮
问题描述:
是否可以使用url来回发按钮(不刷新页面)?
Is it possible to postback the button with a url(without refreshing the page)
答
如果您在后面的代码.单击该按钮将仅触发服务器端事件.取而代之的是,您可以使用简单的HyperLink
并将NavigateURL
属性设置为URL.
您可以使用的一种替代方法是UpdatePanel
以避免整页的PostBack.
--Amit
It''s probably not possible if you are setting the redirection in the code behind. On click of the button it''ll fire server side event only. Instead of that you can use simpleHyperLink
and set theNavigateURL
property to the URL.
One alternative is there which you can use isUpdatePanel
to avoid full page PostBack.
--Amit
嗨
如果要打开其他页面(不同的URL),则可以使用javascript的window.open方法单击该按钮,以弹出窗口的形式打开该页面.
有关window.open的更多信息,请参见下面的链接.
Window open()方法 [使用window.open方法 [
Hi
if you want to open the differnt page (differnt URL) then you can open that page as a popup on click of the button using window.open method of javascript.
refer below links for more on window.open.
Window open() Method[^]
Using the window.open method[^]
try this.
button1.Attributes.Add("onclick","return fnOpenPage()");
//javascript function
function fnOpenPage()
{
return window.open("../YourURL.aspx","mywindow","menubar=yes,resizable=no,width=350");
}
希望对您有所帮助.
hope it helps.