简体   繁体   English

AJAX ComboBox-缺少下拉按钮

[英]AJAX ComboBox - dropdown button missing

Using an AJAX combobox inside of an accordion control. 在手风琴控件内部使用AJAX组合框。 In fact, its an accordion control nested inside another accordion, if that could be a problem. 实际上,如果有问题,它的手风琴控件嵌套在另一个手风琴中。

Anyway -- I have two combo boxes - on the first one it seems like on any page postback the drop down button to see the list of available items disappears. 无论如何-我有两个组合框-在第一个组合框上,似乎在任何页面上都会回传下拉按钮,以查看可用项目列表消失。 On the second one, its never there. 关于第二个,它永远不会存在。

Here is the code: 这是代码:

  <asp:AccordionPane ID="Pane1" runat="server" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" >

<Header>
QUERY VIEW
</Header>

<Content>


        <asp:Label ID="lbl_chkOne" CssClass="label" runat="server" Text="By User" ></asp:Label>
            <input id="chk_One" type="checkbox" onclick="changePane(0,this)" groupKey="query" />
        <asp:Label ID="lbl_chkTwo" CssClass="label" runat="server" Text="All Users" ></asp:Label>
            <input id="chk_Two" type="checkbox" onclick="changePane(1,this)" groupKey="query" />
        <asp:Label ID="lbl_chkThree" CssClass="label" runat="server" Text="Other" ></asp:Label>
            <input id="chk_Three" type="checkbox" onclick="changePane(2,this)" groupKey="query" />
            <br />
            <br />
            <asp:Accordion ID="InnerAccordion" runat="server">
            <Panes>
            <asp:AccordionPane ID="Pane3" runat="server" Visible="true" >
            <Content>
                    <asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="Label2" runat="server" Text="Select a User:" 
                    Style="margin-left:28px" ></asp:Label>

                    <asp:ComboBox ID="cbox_User" runat="server" AutoCompleteMode="SuggestAppend">
                    </asp:ComboBox>
                <asp:Label ID="Label3" runat="server" Text="Select a Month:" 
                                Style="margin-left:28px" ></asp:Label>
            <asp:TextBox ID="txt_Date" runat="server"></asp:TextBox>
             <asp:Label ID="Label1" runat="server" Text="Enter a Price:" 
                                Style="margin-left:28px" ></asp:Label>
             <asp:TextBox ID="txt_Price" runat="server"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender1" runat="server" 
                            TargetControlID="txt_Date" 
                            Format="MMMM yyyy" 
                            OnClientShown="onCalendarShown"
                            OnClientHidden="onCalendarHidden"
                            BehaviorID="calendar1" >
                </asp:CalendarExtender>
                <br />
                </asp:Panel>
            </Content>
            </asp:AccordionPane>
            <asp:AccordionPane ID="Pane4" runat="server" Visible="true" >
            <Content>
              <asp:Panel ID="Panel4" runat="server">
                <asp:Label ID="Label10" runat="server" Text="Select a Group:" 
                    Style="margin-left:28px" ></asp:Label>

                    <asp:ComboBox ID="cbox_Group" runat="server" >
                    <asp:ListItem Text="All Groups"> </asp:ListItem>
                    <asp:ListItem Text="Customers" > </asp:ListItem>
                    <asp:ListItem Text="Employees" > </asp:ListItem>
                    </asp:ComboBox>

                <asp:Label ID="Label11" runat="server" Text="Select a Month:" 
                                Style="margin-left:28px" ></asp:Label>
                <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
             <asp:Label ID="Label12" runat="server" Text="Enter a Price:" 
                                Style="margin-left:28px" ></asp:Label>
             <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>

                <br />
        </asp:Panel>
            </Content>

cbox_User is the one that initially displays the button and then it disappears on postback. cbox_User是最初显示该按钮,然后在回发时消失的按钮。 cbox_Groups is the one that never shows the button. cbox_Groups是一个从不显示按钮的控件。

Here is the code behind that binds data to cbox_User: 以下是将数据绑定到cbox_User的代码:

        protected void BindUsers()
    {
        IQueryable<AqUser> query = from users in db.AqUser
                                   orderby users.username
                                   select users; 

        cbox_User.DataSource = query;
        cbox_User.DataTextField = "username";
        cbox_User.DataValueField = "username"; 
        cbox_User.DataBind(); 
    }

   protected void Page_Load(object sender, EventArgs e)
    {
        db = new DBEntities();
        BindUsers();

        if (!Page.IsPostBack)
            OuterAccordion.Panes[1].Visible = false;
        else
            OuterAccordion.Panes[1].Visible = true; 
    }

I couldn't find much on the internet about this except for some posts about it possibily being related to divs / css alignment. 除了一些可能与divs / css对齐有关的帖子外,我在互联网上找不到很多相关信息。

Any ideas? 有任何想法吗?

Never could solve this. 永远无法解决这个问题。 Must be a big they need to fix. 必须很大,他们需要修复。

I used DropDownList instead of ComboBox and it works fine. 我使用了DropDownList而不是ComboBox,而且效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM