Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使asp列表框的宽度与tablecell的宽度相同_C#_Asp.net - Fatal编程技术网

C# 使asp列表框的宽度与tablecell的宽度相同

C# 使asp列表框的宽度与tablecell的宽度相同,c#,asp.net,C#,Asp.net,我有一个2行4格的表格。第一个和第二个单元格的宽度为桌子的30%,第三个和第四个单元格的宽度为30%,总共为90% Iv尝试将listbox单元格放入面板,并将其宽度设置为30%,将单元格宽度设置为30%,以及其他一些事情,但宽度仍然被忽略 表格本身应为屏幕的100%宽度。 我的列表框不断扩展到超过分配的30%,但我如何才能阻止这种情况 更新:我让列表框停止溢出,但列表框有时比单元格小-我能让它始终与单元格宽度匹配吗?无论文本比宽度短还是长 <div style="overflow: h

我有一个2行4格的表格。第一个和第二个单元格的宽度为桌子的30%,第三个和第四个单元格的宽度为30%,总共为90%

Iv尝试将listbox单元格放入面板,并将其宽度设置为30%,将单元格宽度设置为30%,以及其他一些事情,但宽度仍然被忽略

表格本身应为屏幕的100%宽度。

我的列表框不断扩展到超过分配的30%,但我如何才能阻止这种情况

更新:我让列表框停止溢出,但列表框有时比单元格小-我能让它始终与单元格宽度匹配吗?无论文本比宽度短还是长

<div style="overflow: hidden">
<asp:Table runat="server" Width="100%" GridLines="Horizontal">
    <asp:TableRow Width="100%">
        <asp:TableCell RowSpan="2">
            <asp:ListBox ID="JsonAppKeyListBox" runat="server" AutoPostBack="True" Rows="20" BackColor="#66CCFF" ForeColor="White" onselectedindexchanged="JsonListBox_SelectedIndexChanged">
            </asp:ListBox>
        </asp:TableCell>
        <asp:TableCell RowSpan="2">
            <asp:Panel ID="pnlParentNodes" runat="server" Width="100%">
                <asp:ListBox ID="JsonAppsValueListBox" runat="server" AutoPostBack="True" Rows="20" BackColor="#66CCFF" ForeColor="White" Width="100%">
                </asp:ListBox>
            </asp:Panel>
        </asp:TableCell>
        <asp:TableCell HorizontalAlign="Right" Width="30%">
             <asp:ImageButton ID="imgBtnBack" runat="server" ImageUrl="~/img/analysis/analysis_back_logo.png" Width="30px" HorizontalAlign="Center"/>
             <asp:ImageButton ID="imgBtnDelete" runat="server" ImageUrl="~/img/analysis/analysis_delete_logo.png" Width="30px"/>
            <asp:ImageButton ID="imgBtnConfirm" runat="server" ImageUrl="~/img/analysis/analysis_confirmed_logo.png" Width="30px"/>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell>
            <asp:TextBox ID="tb_nodeNotes" runat="server" Height="300px" Width="100%" BackColor="#66CCFF" ForeColor="White" Rows="30" TextMode="MultiLine">
            </asp:TextBox>
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>
</div>

明白了。需要将列表框、单元格和行分别设置为30%、30%和100%

<div style="overflow: hidden">
<asp:Table runat="server" Width="100%" GridLines="Horizontal">
    <asp:TableRow Width="100%">
        <asp:TableCell RowSpan="2" Width="30%">
            <asp:ListBox ID="JsonAppKeyListBox" runat="server" AutoPostBack="True" Rows="20" BackColor="#66CCFF" ForeColor="White" onselectedindexchanged="JsonListBox_SelectedIndexChanged" Width="100%">
            </asp:ListBox>
        </asp:TableCell>
        <asp:TableCell RowSpan="2" Width="30%">
                <asp:ListBox ID="JsonAppsValueListBox" runat="server" AutoPostBack="True" Rows="20" BackColor="#66CCFF" ForeColor="White" Width="100%" Height="100%">
                </asp:ListBox>

        </asp:TableCell>
        <asp:TableCell HorizontalAlign="Right" Width="30%">
             <asp:ImageButton ID="imgBtnBack" runat="server" ImageUrl="~/img/analysis/analysis_back_logo.png" Width="30px" HorizontalAlign="Center"/>
             <asp:ImageButton ID="imgBtnDelete" runat="server" ImageUrl="~/img/analysis/analysis_delete_logo.png" Width="30px"/>
            <asp:ImageButton ID="imgBtnConfirm" runat="server" ImageUrl="~/img/analysis/analysis_confirmed_logo.png" Width="30px"/>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell>
            <asp:TextBox ID="tb_nodeNotes" runat="server" Height="300px" Width="100%" BackColor="#66CCFF" ForeColor="White" Rows="30" TextMode="MultiLine">
            </asp:TextBox>
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>
</div>