asp.net中的“回发"按钮 [英] postback button in asp.net

查看:53
本文介绍了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 simple HyperLink and set the NavigateURL property to the URL.

One alternative is there which you can use is UpdatePanel 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.


这篇关于asp.net中的“回发"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆