473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Range Validation in an EditItemTemplate

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
Nov 19 '05 #1
1 1409
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: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eq**************@TK2MSFTNGP14.phx.gbl...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kevin | last post by:
Hi all, I'm now very frustrated, I've been battling all of today to try and understand the datalist, editing, inserting, updating, etc, I have managed to get most of that sort of stuff...
0
by: Krish | last post by:
Hello Gurus, Pl. help. I need to validate a control in datagrid based on check box selection. Basically in a datagrid i have checkbox and textbox control for edititemtemplate. If checkbox is...
1
by: mg | last post by:
How can I apply validation for date and currency on the values typed in EditItemTemplate TextBoxes in a DataGrid (C# WebForm)
1
by: G Dean Blake | last post by:
Is the any way to use a regularexpressionvalidator to validate information entered in a datagrid after the rows edit button is pushed? I know I can do it server side but I want to do it client...
2
by: Walter | last post by:
I have a GridView using Template columns. In my EditItemTemplate I am using CompareValidators to check data types. When validation fails, I would like to change the border of the textbox in...
1
by: Microsoft News Group | last post by:
I am trying to validate two textboxes as their values are the same, or both are null do not insert the data. I do not just want one to try to be null, I want both of them, so the requirevalidator...
0
by: Matt | last post by:
I have a simple datagrid that shows configuration properties as Name : Value pairs. I want to be able to programmatically change the validation controls that apply based on the name field of the...
1
by: raam | last post by:
Hi, I have ajax tab container with 6 tabs in it. I need to validate each tab contents separately and the validtaion summary must be separate for each tab. i cannot do that only one summary is...
2
by: mrutyunjaya | last post by:
hello, i have two textbox column and one button control in gridvie when i click button it will ask plese enter price in first textbox . when enter values it is asking again. how to pass...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.