如何使用DropDownCheckBoxes所需的字段验证器?

时间:2015-02-02 21:58:53

标签: asp.net ajax c#-4.0

Drop Down CheckBoxList control

如何使用必填字段验证?我只想要客户端验证。当我集中注意力时,我想显示错误消息。

<cc2:DropDownCheckBoxes id="cblCustomerList" runat="server" width="180px">
    <style selectboxwidth="195" dropdownboxboxwidth="160" dropdownboxboxheight="195" />
    <items>
        <asp:ListItem Text = "Kidneys Donor" Value = "Kidneys Donor"></asp:ListItem>
        <asp:ListItem Text = "Lungs Donor" Value = "Lungs Donor" >Eye Donor</asp:ListItem>
        <asp:ListItem Text = "Pancreas Donor" Value = "Pancreas Donor" >Blood Donor</asp:ListItem>
        <asp:ListItem Text = "One" Value = "1">Heart Donor</asp:ListItem>
        <asp:ListItem Text = "One" Value = "1" >Liver Donor</asp:ListItem>
        <asp:ListItem  >Kidneys Donor</asp:ListItem>
        <asp:ListItem>Lungs Donor</asp:ListItem>
        <asp:ListItem>Pancreas Donor</asp:ListItem>
        <asp:ListItem>Intestines Donor</asp:ListItem>
        <asp:ListItem>Cornea Donor</asp:ListItem>
        <asp:ListItem>Skin Donor</asp:ListItem>
        <asp:ListItem>Heart Valves Donor</asp:ListItem>
        <asp:ListItem>Tendons Donor</asp:ListItem>
    </items>
</cc2:DropDownCheckBoxes>

1 个答案:

答案 0 :(得分:0)

您需要使用ExtendedRequiredFieldValidator控件。希望你有DLL(DropDownCheckBoxes.dll)。

<asp:ExtendedRequiredFieldValidator ID = "ExtendedRequiredFieldValidator1" runat = "server" ControlToValidate = "YourDropDownCheckBoxeID" ErrorMessage = "Required" ForeColor = "Red"></asp:ExtendedRequiredFieldValidator>
相关问题