如何在无线电组列表上重定向用户群? [英] How to redirect a user base on a radiogrouplist?

查看:44
本文介绍了如何在无线电组列表上重定向用户群?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   asp:RadioButtonList     ID   =  RadioButtonList1    runat   =  server >  
< asp:ListItem > 选项1 < / asp:ListItem >
< asp:ListItem > Option2 < / asp:ListItem >
< asp:ListItem > Option3 < / asp:ListItem < span class =code-keyword>>
< asp:ListItem > Option4 < / asp:ListItem >
< asp :ListItem > Option5 < / asp:ListItem >
< asp:ListItem > Option6 < / asp:ListItem >
< / asp:RadioButtonList >

< p > < / p > ;
< p > < / p >
< asp:按钮 ID = Button1 runat = server 文字 = 转到URl OnClick = Button1_Click / >







如果用户点击Option1然后我想将他重定向到www.URL1.com

如果他点击Option2然后我想重定向他到www.someplace.com



我尝试过:



< asp:Button ID =Button1runat =serverText =Go to URlOnClick =Button1_Click/>

解决方案

这是你应该能够做到的事情。但是,一个简单的例子:



  if (RadioButtonList.SelectedItem。 Text ==   Option1
{
Response.Redirect( someurl);
}


<asp:RadioButtonList ID="RadioButtonList1" runat="server">
    <asp:ListItem>Option1</asp:ListItem>
    <asp:ListItem>Option2</asp:ListItem>
    <asp:ListItem>Option3</asp:ListItem>
    <asp:ListItem>Option4</asp:ListItem>
    <asp:ListItem>Option5</asp:ListItem>
    <asp:ListItem>Option6</asp:ListItem>
</asp:RadioButtonList>

    <p></p>
    <p></p>
    <asp:Button ID="Button1" runat="server" Text="Go To URl" OnClick="Button1_Click" />




If the user clicks Option1 then i want to redirect him to www.URL1.com
if he click Option2 then i want to redirect him to www.someplace.com

What I have tried:

<asp:Button ID="Button1" runat="server" Text="Go To URl" OnClick="Button1_Click" />

解决方案

This is something very easy that you should be able to do yourself. However, a simple example:

if (RadioButtonList.SelectedItem.Text == "Option1")
{
  Response.Redirect("someurl");
}


这篇关于如何在无线电组列表上重定向用户群?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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