Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validate over several Web User Controls

Reply
Thread Tools

Validate over several Web User Controls

 
 
Moistly
Guest
Posts: n/a
 
      08-17-2007
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

 
Reply With Quote
 
 
 
 
seigo
Guest
Posts: n/a
 
      08-17-2007
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

 
Reply With Quote
 
 
 
 
Moistly
Guest
Posts: n/a
 
      08-20-2007
On Aug 17, 4:25 pm, seigo <seigo...@gmail.com> wrote:
> 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.
> MCPwww.klalex.com


Thanks alot, that does indeed work.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
RDOC: several related modules in several C files Victor \Zverok\ Shepelev Ruby 3 03-16-2007 04:15 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Building Controls 1 01-04-2005 04:09 PM
User Control not in available controls to validate thadpeiffer ASP .Net Web Controls 0 10-06-2004 03:41 PM
IntelliSense on Web User Controls and Web Custom Controls Axel Dahmen ASP .Net 1 11-12-2003 06:12 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57