按钮单击事件中的多个response.redirect(url) [英] multiple response.redirect(url) in a button click event

查看:57
本文介绍了按钮单击事件中的多个response.redirect(url)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

我想在asp.net 4(C#)中重定向到服务器端的多个url。

当我写Response.redirect(url)3时在代码中的时间,首先重定向是有效的。

我该如何解决这个问题?



我的代码在下面并且没有正常工作。

protected void libraryButton_Click(object sender,EventArgs e)

{

// librarylist是CheckListBox

string url = libraryBox.Text;

string url1 = libraryBox1.Text;

string url2 = libraryBox2.Text;

if(librarylist.Items [0] .Selected)

Response.Redirect(url);

if(librarylist.Items [1] .Selected)

Response.Redirect(url1 );

if(librarylist.Items [2] .Selected)

Response.Redirect(url2);

}







谢谢。

hi.
I want to redirect to multiple url in server side in asp.net 4(C#).
When i write Response.redirect(url) 3 times in code, first redirect works.
how can i solve this problem?

my code is below and is not worke correctly.
protected void libraryButton_Click(object sender, EventArgs e)
{
//librarylist is CheckListBox
string url = libraryBox.Text;
string url1 = libraryBox1.Text;
string url2 = libraryBox2.Text;
if(librarylist.Items[0].Selected)
Response.Redirect(url);
if(librarylist.Items[1].Selected)
Response.Redirect(url1);
if(librarylist.Items[2].Selected)
Response.Redirect(url2);
}



thank you.

推荐答案

你可以确认为什么你要重定向到三个页面,而不是当你点击后退按钮时重定向你的前两页作为弹出窗口,并重定向到第三个网址,这应该明确地解决你的问题。

<打开弹出窗口的
你可以使用Page.regiserStartupScript(-----------------)方法。



希望这符合您的标准.....
can you confirm why you want to redirect to three pages, instead of redirecting when you click on back button displau your 1st two pages as popups and redirect to the third url which should definately solve your problem.

for opening popup u can use Page.regiserStartupScript(-----------------) method.

hope this meets your criteria.....


这篇关于按钮单击事件中的多个response.redirect(url)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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