I want to make sure that the SelectedDate property of the Calendar control
is later than the current date or that a certain checkbox is selected. I
tried to use a CustomValidator control with the following code:
Private Sub validTimeFrame_ ServerValidate( ByVal source As System.Object,
ByVal args As System.Web.UI.W ebControls.Serv erValidateEvent Args) Handles
validTimeFrame. ServerValidate
If chkUnknown.Chec ked OrElse calTimeFrame.Se lectedDate >= Date.Today Then
args.IsValid = True
Else
args.IsValid = False
End If
End Sub
As you can see, I check to see if chkUnknown is checked or if
calTimeFrame.Se lectedDate>= Date.Today. If either one is true, then I assign
True to the IsValid property, otherwise I assign it a value of false.
However, when I test the page it brings up the following error:
[HttpException (0x80004005): Control 'calTimeFrame' referenced by the
ControlToValida te property of 'validTimeFrame ' cannot be validated.]
System.Web.UI.W ebControls.Base Validator.Check ControlValidati onProperty(Stri ng
name, String propertyName)
System.Web.UI.W ebControls.Cust omValidator.Con trolPropertiesV alid()
System.Web.UI.W ebControls.Base Validator.get_P ropertiesValid( )
System.Web.UI.W ebControls.Base Validator.Rende r(HtmlTextWrite r writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.W ebControls.WebC ontrol.RenderCo ntents(HtmlText Writer
writer)
System.Web.UI.W ebControls.Tabl eCell.RenderCon tents(HtmlTextW riter writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.W ebControls.WebC ontrol.RenderCo ntents(HtmlText Writer
writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.W ebControls.Tabl e.RenderContent s(HtmlTextWrite r writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.H tmlControls.Htm lForm.RenderChi ldren(HtmlTextW riter writer)
System.Web.UI.H tmlControls.Htm lContainerContr ol.Render(HtmlT extWriter
writer)
System.Web.UI.H tmlControls.Htm lForm.Render(Ht mlTextWriter output)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.P age.ProcessRequ estMain()
Because this tells me nothing more than that the control cannot be
validated, I do not know where to start. Any ideas? Thanks.
--
Nathan Sokalski
njsokalski@hotm ail.com
is later than the current date or that a certain checkbox is selected. I
tried to use a CustomValidator control with the following code:
Private Sub validTimeFrame_ ServerValidate( ByVal source As System.Object,
ByVal args As System.Web.UI.W ebControls.Serv erValidateEvent Args) Handles
validTimeFrame. ServerValidate
If chkUnknown.Chec ked OrElse calTimeFrame.Se lectedDate >= Date.Today Then
args.IsValid = True
Else
args.IsValid = False
End If
End Sub
As you can see, I check to see if chkUnknown is checked or if
calTimeFrame.Se lectedDate>= Date.Today. If either one is true, then I assign
True to the IsValid property, otherwise I assign it a value of false.
However, when I test the page it brings up the following error:
[HttpException (0x80004005): Control 'calTimeFrame' referenced by the
ControlToValida te property of 'validTimeFrame ' cannot be validated.]
System.Web.UI.W ebControls.Base Validator.Check ControlValidati onProperty(Stri ng
name, String propertyName)
System.Web.UI.W ebControls.Cust omValidator.Con trolPropertiesV alid()
System.Web.UI.W ebControls.Base Validator.get_P ropertiesValid( )
System.Web.UI.W ebControls.Base Validator.Rende r(HtmlTextWrite r writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.W ebControls.WebC ontrol.RenderCo ntents(HtmlText Writer
writer)
System.Web.UI.W ebControls.Tabl eCell.RenderCon tents(HtmlTextW riter writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.W ebControls.WebC ontrol.RenderCo ntents(HtmlText Writer
writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.W ebControls.Tabl e.RenderContent s(HtmlTextWrite r writer)
System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.H tmlControls.Htm lForm.RenderChi ldren(HtmlTextW riter writer)
System.Web.UI.H tmlControls.Htm lContainerContr ol.Render(HtmlT extWriter
writer)
System.Web.UI.H tmlControls.Htm lForm.Render(Ht mlTextWriter output)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer)
System.Web.UI.C ontrol.Render(H tmlTextWriter writer)
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer)
System.Web.UI.P age.ProcessRequ estMain()
Because this tells me nothing more than that the control cannot be
validated, I do not know where to start. Any ideas? Thanks.
--
Nathan Sokalski
njsokalski@hotm ail.com
Comment