0
PopControl Extender를 통해 TextBox에 연결된 다중 선택 CheckBoxList가있는 패널을 만듭니다.Popextender는 커밋 후 패널을 닫습니다.
확장자 PopControl
의 .commit()
방법을 사용하여 선택한 항목을 표시하고 있습니다.
CheckBoxist에서 항목을 선택하면 패널이 닫히고 패널을 닫지 않고 항목을 선택하려고합니다.
내가 뭘 잘못하고 있니? 이 AutoPostBack = "true"
을 가지고 원인이 체크 박스 중 하나를 클릭하면
마크 업
<asp:TextBox ID="txtCountry" runat="server" Skinid="longTextbox" AutoPostBack = "false" OnClientItemSelected="passtohidden()" />
<asp:Panel ID="pnlLocation" runat="server">
<asp:UpdatePanel runat="server" ID="upLocation">
<ContentTemplate>
<asp:CheckBoxList ID="chkLocation" SkinID ="chkColor" runat="server" AutoPostBack = "true" onselectedindexchanged="chkLocation_SelectedIndexChanged" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtCountry" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<asp:PopupControlExtender ID="Panel1_PopupControlExtender" runat="server" Enabled="True" Position="Bottom" PopupControlID = "pnlLocation" TargetControlID="txtCountry" />
코드 뒤에
protected void chkLocation_SelectedIndexChanged(object sender, EventArgs e)
{
string strSelected = "";
foreach (ListItem l in chkLocation.Items)
{
if (l.Selected)
{
strSelected += l.Text + " ,";
}
}
//txtCountry.Text = strSelected;
Panel1_PopupControlExtender.Commit(strSelected);
}