在单选按钮列表中加入多视点 [英] adding multiview in radiobuttonlist

查看:154
本文介绍了在单选按钮列表中加入多视点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < ASP:RadioButtonList的ID =lstTrip=服务器的AutoPostBack =真RepeatDirection =水平FONT-名称=宋体FONT-SIZE =小onselectedindexchanged =lstTrip_SelectedIndexChanged>
< ASP:列表项选择=真值=单向 - 酮方式与LT; / ASP:ListItem的>
< ASP:ListItem的值=往返>往返< / ASP:ListItem的>
< ASP:ListItem的值=多城市>多市及LT; / ASP:ListItem的>

 如果(lstTrip.SelectedValue.ToLower()==往返)
{
    //更改选定的多视点指数
    MultiView1.ActiveViewIndex = 1;
}
其他
{
    MultiView1.ActiveViewIndex = 0;
}


  

我已经给我的ASP code和code.First我有只有两个观点是一种方式,往返,现在我想添加一个视图按钮多城市,这样的.cs我怎么样西港岛线disaplay从我的.cs code查看,什么样的变化我在我给出的.cs code.PLZZZ有助于使



解决方案

在它的网页加载写

 保护无效的Page_Load(对象发件人,EventArgs的发送)
{      如果(!的IsPostBack)
        {
            MultiView1.ActiveViewIndex = 1; //将厂景指数           }
}

<asp:RadioButtonList ID="lstTrip" runat="server" AutoPostBack="True" RepeatDirection="Horizontal" Font-Names="Arial" Font-Size="Small" onselectedindexchanged="lstTrip_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="OneWay">One Way</asp:ListItem>
<asp:ListItem Value="RoundTrip">Round Trip</asp:ListItem>
<asp:ListItem Value="MultiCity">Multi City</asp:ListItem>

if (lstTrip.SelectedValue.ToLower() == "roundtrip")
{
    //Change the selected multiview index 
    MultiView1.ActiveViewIndex = 1;
} 
else 
{
    MultiView1.ActiveViewIndex = 0;
}

i have given my asp code and .cs code.First i was having only two view which is one way and round trip, now i want to add one more view for multicity button,so how i wil disaplay that view from my .cs code, what changes i have to make in my given .cs code.PLZZZ HELP

解决方案

write it in page load

    protected void Page_Load(object sender, EventArgs e)
{

      if (!IsPostBack)
        {
            MultiView1.ActiveViewIndex = 1;  //index of the view1

           }
}

这篇关于在单选按钮列表中加入多视点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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