On Aug 17, 5:28 pm, Moistly <pfranc...@gmail.com> wrote:
> Hi everyone,
>
> This is a scenerio for my problem,
>
> I have one aspx page with several instances of the same Web User
> Control (ascx files).
>
> I have for example the Web User Control that has a textbox that
> requires a numeric value (I am using the RequiredField, and
> RangeValidator here with no problems)
>
> What I also need to validate, is that 1 (and only 1) instance of the
> Web User Control is given a textbox value > 0, while all the others
> must be == 0.
>
> Any advice?
> Thanks
Hi Moistly,
I think that you should do the following:
1) add a public property for web user control that will contain the
value of textbox:
public int Value
{
get { return Convert.ToInt32(TextBox1.Text); }
}
2) add CustomValidator to page where you placed a few instances of web
user controls. In CustomControl function check Value of all web user
controls and if only one has Value > 0 then return true in other way -
false.
Regards,
Alexander Kleshchevnikov.
MCP
www.klalex.com