AJAX ComboBox呈现为TextBox

时间:2011-06-10 16:17:17

标签: asp.net asp.net-ajax combobox ajaxcontroltoolkit

我有2个组合框的页面。它们都有不相关的数据集,所以级联组合框似乎没有意义。当页面呈现组合框A很好时,B呈现为文本框。如果我禁用组合框A,那么B将正确渲染。

以下是我的定义(每个组合框都在自己的面板中)。

<asp:ComboBox ID="cboRequestType" runat="server" CssClass="comboBoxes" 
    DropDownStyle="DropDownList" ItemInsertLocation="Append" AutoPostBack="True"
    AppendDataBoundItems="True" onselectedindexchanged="cboRequestType_SelectedIndexChanged">
    <asp:ListItem Selected="True" Text="Select Request Type..." Value="Select Request Type" />
</asp:ComboBox>

<asp:ComboBox ID="cboContactName" runat="server" CssClass="comboBoxes" 
    DropDownStyle="DropDownList" ItemInsertLocation="Append" AutoPostBack="True"
    AppendDataBoundItems="True" onselectedindexchanged="cboContactName_SelectedIndexChanged">
</asp:ComboBox>

以下是完整的细分和对测试用例的更好描述。

  1. 当页面加载两个组合框时cboContactName呈现为txtbox。
  2. 如果我发送了pnlRequestType.visible = false,那么cboContactName会正确呈现。
  3. 将cboRequestType更改为元素允许cboContactName呈现为组合者。

    <asp:Panel ID="pnlRequestType" runat="server">
        <asp:Label ID="lblRequestType" Text="Request Type" runat="server"
            CssClass="comboBoxLabel" />
        <asp:ComboBox ID="cboRequestType" runat="server" CssClass="comboBoxes" 
            DropDownStyle="DropDownList" ItemInsertLocation="Append" AutoPostBack="True"
            AppendDataBoundItems="True" onselectedindexchanged="cboRequestType_SelectedIndexChanged">
            <asp:ListItem Selected="True" Text="Select Request Type..." Value="Select Request Type" />
        </asp:ComboBox>     
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ErrorMessage="Select A Catagory." CssClass="fieldValidationMessage" 
            ControlToValidate="cboRequestType" InitialValue="Select Request Type" >
        </asp:RequiredFieldValidator>
    </asp:Panel>
    
    <asp:Panel ID="pnlContact" runat="server">
        <asp:Label ID="lblContactName" Text="Contact" runat="server"    
            AssociatedControlID="cboContactName" CssClass="comboBoxLabel" />
        <asp:ComboBox ID="cboContactName" runat="server" CssClass="comboBoxes" 
            DropDownStyle="DropDownList" ItemInsertLocation="Append" AutoPostBack="True"
            AppendDataBoundItems="True" onselectedindexchanged="cboContactName_SelectedIndexChanged">
        </asp:ComboBox>
    </asp:Panel>
    

0 个答案:

没有答案