Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Setting RangeValidator Maximum


Message #1 by "Peter Lawrence" <peter.lawrence@p...> on Wed, 8 May 2002 10:45:50 +0100
Thanks Chuck

I also found an alternative:
- declare a Public variable in the code-behind file and set that (once) from
code
- use MaximumValue="<%# myMax %>" within the definition of the
RangeValidator on the page

Peter

----- Original Message -----
From: "Feduke Cntr Charles R" <FedukeCR@m...>
To: "ASPX_Professional" <aspx_professional@p...>
Sent: Wednesday, May 08, 2002 3:09 PM
Subject: [aspx_professional] RE: Setting RangeValidator Maximum


> Hrm, something like (from memory, may not be exact):
>
> protected System.Web.UI.HtmlControls.HtmlForm yourForm;
> private void Page_Load(object sender, System.EventArgs e)
> {
> foreach (System.Web.UI.Control ctl in yourForm)
> {
> if (typeof(ctl) is System.Web.UI.WebControls.RangeValidator)
>
> ((System.Web.UI.WebControls.RangeValidator)ctl).MaximumValue = 12;
> }
> }
>
> HTH,
> - Chuck
>
> -----Original Message-----
> From: Peter Lawrence [mailto:peter.lawrence@p...]
> Sent: Wednesday, May 08, 2002 5:46 AM
> To: ASPX_Professional
> Subject: [aspx_professional] Setting RangeValidator Maximum
>
>
> I'm trying to set the MaximumValue in a <ASP:RangeValidator...> - easy
> enough:
>
> myRangeValidator.MaximumValue=max
>
> ...but this is on a TextBox in a TemplateColumn within a DataGrid, and
> (understandably) I get an error saying that the Object reference is not
set
> to an instance (since this is a template for a whole bunch of instances).
So
> how do I set the (same) MaximumValue for all the RangeValidators?
>
> Thanks
> Peter Lawrence
>
>
>
>
>


  Return to Index