당신은 자바 스크립트 당 패널 폭 온로드를 설정할 수 있습니다 : 도움에 대한
<script>
function resizePanel() {
var panel = document.getElementById('Panel1');
var checkBox = document.getElementById('CheckBoxList1')
if (panel != null && checkBox != null)
panel.style.width = checkBox.offsetWidth + "px";
}
</script>
</head>
<body onload="resizePanel()">
<form id="form1" runat="server">
<asp:Panel ID="Panel1" runat="server" BorderWidth="1" BorderColor="Silver">
<asp:CheckBoxList ID="CheckBoxList1" Width="200px" runat="server">
<asp:ListItem Text="Item 1" Value="1"></asp:ListItem>
<asp:ListItem Text="Item 2" Value="2"></asp:ListItem>
<asp:ListItem Text="Item 3" Value="3"></asp:ListItem>
<asp:ListItem Text="Item 4" Value="4"></asp:ListItem>
<asp:ListItem Text="Item 5" Value="5"></asp:ListItem>
<asp:ListItem Text="Item 6" Value="6"></asp:ListItem>
<asp:ListItem Text="Item 7" Value="7"></asp:ListItem>
</asp:CheckBoxList>
</asp:Panel>
</form>
</body>
</html>
감사합니다. 이것은 나를 위해 일하고 있는데, offsetWidth가 25 픽셀보다 크다는 것을 확인해야한다. 그렇지 않으면 체크 박스 목록에 데이터가 없을 때 offsetwidth가 0이었고 어떤 이유로 든 내 패널이 IE와 Firefox에서 전체 화면을 차지했습니다. – larryq