DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 17 Aug 2007 07:28:06 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Moistly
          2    seigo
          3    Moistly


Validate over several Web User Controls   
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
Date:Fri, 17 Aug 2007 07:28:06 -0700   Author:  

Re: Validate over several Web User Controls   
On Aug 17, 5:28 pm, Moistly  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
Date:Fri, 17 Aug 2007 08:25:56 -0700   Author:  

Re: Validate over several Web User Controls   
On Aug 17, 4:25 pm, seigo  wrote:

> On Aug 17, 5:28 pm, Moistly  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.
Date:Mon, 20 Aug 2007 08:01:29 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us