2011-05-10 58 views
0

因此,根據radiobuttonlist中選擇什麼,我希望選擇命令改變我的數據源。我面臨的問題是,如果我設置的默認選中的單選按鈕查詢將針對數據源選擇命令不會改變單選按鈕列表

我的單選按鈕列表,用戶(下拉列表都位於一個更新面板的按鈕後未更新工作被點擊

這是我的按鈕代碼

If user.Text = "ALL" Then 
        SqlDataSource22.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE [completed] = 'NO'" 
        SqlDataSource23.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE (([agent] = @agent) AND (([completed] = 'YES') or ([completed] = 'XL')))" 
       Else 
        If RadioButtonList1.SelectedIndex = 0 Then 
         SqlDataSource22.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE (([agent] = @agent) AND ([completed] = @completed))" 
         SqlDataSource23.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE (([agent] = @agent) AND (([completed] = 'YES') or ([completed] = 'XL')))" 

        ElseIf RadioButtonList1.SelectedIndex = 1 Then 
         SqlDataSource22.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE (([agent] = @agent) AND ([completed] = @completed) and tasktype = 'Air')" 
         SqlDataSource23.SelectCommand = "SELECT * FROM [dashboardtasks] WHERE (([agent] = @agent) AND (([completed] = 'YES') or ([completed] = 'XL')) and tasktype = 'Air')" 
        End If 
       End If 

    UpdatePanel1.Update() 
     UpdatePanel2.Update() 





<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> 
           <asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional"> 
            <ContentTemplate> 
             <asp:Panel ID="Panel9" runat="server" Height="24px" Width="392px"> 
              <asp:DropDownList ID="ddivision" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddivision_SelectedIndexChanged"> 
            <asp:ListItem Selected="True">All</asp:ListItem> 
            <asp:ListItem Value="A">Club ABC</asp:ListItem> 
            <asp:ListItem Value="B">ABC Destinations</asp:ListItem> 
           </asp:DropDownList> 
           <asp:DropDownList ID="userslist" runat="server" Height="20px" Width="184px"></asp:DropDownList> 
         <asp:Button ID="updatediary" runat="server" Text="Update" /></asp:Panel> 
           <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatColumns="5" > 
            <asp:ListItem>All</asp:ListItem> 
            <asp:ListItem Selected="True">Land</asp:ListItem> 
            <asp:ListItem>Air</asp:ListItem> 
            <asp:ListItem>Cruise</asp:ListItem> 
           </asp:RadioButtonList> 
            </ContentTemplate> 
            <Triggers> 
             <asp:AsyncPostBackTrigger ControlID="ddivision" /> 
            </Triggers> 
           </asp:UpdatePanel> 

回答

0

我敢打賭,你的radiobuttonlist不在updatepanel,這就是爲什麼沒有被刷新過。要更新radiobuttonlist,你需要把它放在一個updatepanel

您需要指定控件的事件名稱:Event="SelectedIndexChanged"

<Triggers> 
    <asp:AsyncPostBackTrigger ControlID="ddivision" Event="SelectedIndexChanged" /> 
</Triggers> 
+0

我tryed,它沒有工作,即時通訊甚至updateing使用自動回的單選按鈕列表和下拉列表 – 2011-05-10 14:24:12

+0

您可以發佈您完整的表單設計的面板? – 2011-05-10 14:25:02

+0

什麼都可以幫我解決這個問題其驅動我堅果大聲笑 – 2011-05-10 14:26:57

相關問題