Академический Документы
Профессиональный Документы
Культура Документы
adding .dll file into asp.net project and custom validator for checkbox list
================================================================================
---------------------------------------------
example code in class library:::
--------------------------------------------
using system;
using system.web.ui;
using system.web.ui.webcontrols;
using system.componentmodel;
namespace customvalidators
{
public class requiredfieldvalidatorforcheckboxlists :
system.web.ui.webcontrols.basevalidator
{
private listcontrol _listctrl;
public requiredfieldvalidatorforcheckboxlists()
{
base.enableclientscript = false;
}
if (ctrl != null)
{
_listctrl = (listcontrol) ctrl;
return (_listctrl != null);
}
else
return false; // raise exception
}
</script>
<body>
<form runat="server">
<asp:checkboxlist id="cblist" runat="server">
<asp:listitem value="hello" />
<asp:listitem value="world!" />
</asp:checkboxlist>
<customvalidators:requiredfieldvalidatorforcheckboxlists
id="reqcblist" runat="server" controltovalidate="cblist"
errormessage="please select at least one checkbox..." />