0
我创建了一个多选CheckBoxList的面板,通过PopControl扩展器连接到TextBox。Popextender在提交后关闭面板
我正在使用PopControl
扩展器的.commit()
方法来显示所选项目。
当我从CheckBox中选择一个项目时,面板关闭,我想选择该项目而不关闭面板。
我在做什么错?当您单击其中一个复选框导致它有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);
}