多重复选框下拉列表 [英] Multi check box drop down list

查看:122
本文介绍了多重复选框下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我为多重检查下拉列表创建了一个Web用户控件。

这是代码片段:

Hi All,
I have created a web user control for multi check drop down list.
Here is code snippet:

<asp:TextBox ID="txtCombo" runat="server" ReadOnly="true" Text="--Select--" CssClass="DropDownCss" BackColor="#EEEEEE" Width="225" Height="25" ></asp:TextBox>
<cc1:PopupControlExtender ID="PopupControlExtender111"  runat="server" 
    TargetControlID="txtCombo" PopupControlID="Panel111" Position="Bottom" >
</cc1:PopupControlExtender>

<input type="hidden" name="hidVal" id="hidVal" runat="server" />

<asp:Panel ID="Panel111" runat="server"  Width="230" BackColor="#EEEEEE" BorderColor="Gray" BorderWidth="1">
    
    <asp:CheckBoxList ID="chkList" 
        runat="server" 
        Height="150" onclick="CheckItem(this)">                                                                                                                                                                        
    </asp:CheckBoxList>
    
</asp:Panel>





控件正在获取绑定并显示值但是当页面获得回发时控制正在重新初始化。



即使页面回发,如何保持当前选定的值。



请建议



谢谢和问候,

Avinash



The control is getting bind and showing values but when page is getting postback the control is getting reinitialize.

How to keep current selected values even if page is postback.

Please suggest

Thanks and Regards,
Avinash

推荐答案

Loading of your checklist should check Page.isPostBack property and it not PostBack then load it.

if(!Page.isPostBack){
// load your checklist
}


这篇关于多重复选框下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆