Validate - Web User Management

I don’t like using the calendar with .NET, so I would like to have one web user control with three drop-down boxes, day, month, year. [CODE DONE].

I want to be able to call this control and initialize it at the beginning and end of the year, as well as with or without a selected date. [CODE DONE].

This control will see if there is a valid date selected and return bool [CODE DONE].

Then on my webpage, I would like to find out if this web user control is valid in a way that I can use with a normal .NET check (link one required field), the problem is that I don’t know, t know where to put this code and get it for verification on a web page. [CODE NOT DONE] .

How can i do this?

0
source share
2 answers

There are two ways to integrate custom server controls with a validation framework.

(1) server side: you need to add ValidationPropertyAttribute to the class, so framwework check knows what to look at when checking:

[ValidationProperty("SelectedDate")]
public class MyDateControl : WebControl
{
    public DateTime? SelectedDate { get { ... } set { ... } }
} 

(2) , , , . - < input type = "hidden" > - HTML. . , , , JavaScript , .

, . , CustomValidator.

+1

CustomValidator. . , , , .

0

All Articles