Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Range Validation in an EditItemTemplate

Reply
Thread Tools

Range Validation in an EditItemTemplate

 
 
tshad
Guest
Posts: n/a
 
      02-07-2005
Can you do Range Validation inside of an EditItemTemplate of the DataGrid?

I have one set up as:

******************************************
<td>
<asp:TextBox Columns="3" id="Weight" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Weight") %>' />
<asp:RangeValidator
ControlToValidate="Weight"
MinimumValue="1"
MaximumValue="10"
Type="Integer"
Text="The Value must be be from 1 to 10!"
runat="server"/>
</td>
************************************************** *************

But nothing seems to happen when I push the update button.

It takes whatever value I put in and doesn't seem to check it.

Thanks,

Tom


 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      02-07-2005
You have done it correctly. The only issues are:
1. The RangeValidator doesn't report an error when the field is empty.
Assign RequiredFieldValidator.
2. The RangeValidator doesn't report an error when the field contains a
value that does not match the Type property, like "abc" is illegal for
Type="integer". Assign a CompareValidator, Operator=DataTypeCheck,
Type=Integer.

--- Peter Blum
www.PeterBlum.com
Email:
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"tshad" <> wrote in message
news:...
> Can you do Range Validation inside of an EditItemTemplate of the DataGrid?
>
> I have one set up as:
>
> ******************************************
> <td>
> <asp:TextBox Columns="3" id="Weight" runat="server" Text='<%#
> DataBinder.Eval(Container.DataItem, "Weight") %>' />
> <asp:RangeValidator
> ControlToValidate="Weight"
> MinimumValue="1"
> MaximumValue="10"
> Type="Integer"
> Text="The Value must be be from 1 to 10!"
> runat="server"/>
> </td>
> ************************************************** *************
>
> But nothing seems to happen when I push the update button.
>
> It takes whatever value I put in and doesn't seem to check it.
>
> Thanks,
>
> Tom
>



 
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
How can I transform source range to destination range that is thesame as source? Lambda C++ 2 07-16-2008 05:18 PM
range() is not the best way to check range? Summercoolness@gmail.com Python 46 07-25-2006 08:10 PM
Scene range vs dynamic range Robert Feinman Digital Photography 2 07-04-2005 09:30 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM
Validation of EditItemTemplate TextBoxes in a DataGrid =?Utf-8?B?bWc=?= ASP .Net 1 05-18-2004 05:36 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