2013-11-09 42 views
0
<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; 
} 

我已經給我的ASP代碼和的.cs code.First我有隻有兩個觀點是單向和往返,現在我想添加對於多城市按鍵多了一個觀點,所以我怎麼港島線從我的.cs代碼disaplay這種看法有什麼變化我在我給出的.cs使code.PLZZZ HELP

回答

0

它寫在頁面加載

protected void Page_Load(object sender, EventArgs e) 
{ 

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

      } 
} 
+0

Thnx的幫助.. :) – Naveen31

+0

樂意幫忙.. !! :) –

+0

你能評論你的代碼嗎?爲什麼這是一個解決方案,它是如何工作的? – user35443

0

將您的.cs代碼更改爲以下內容並嘗試。

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