Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 29th, 2004, 04:52 AM
Authorized User
 
Join Date: Feb 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Required Field Validator to a datagrid editt item

Tried this on another forum, but this is really a how to questions:

I want to add a Required Field Validator to a Datagrid Edit Item. I know i could do this using a template column but i forgot to add this functionality in at the start so if i could just add the functionality to the existing boundcolums dynamically or in some other way it would be great.

The onyl way i have tried so far is to try and add the control when i fire a sub from the OnItemDataBound event of the datagrid.

the sub i fire contains the following code

If (E.Item.ItemType = ListItemType.EditItem) Then
            Dim rqdTitle As New RequiredFieldValidator

            E.Item.Cells(3).Controls.Add(rqdTitle)
            rqdTitle.ControlToValidate = (E.Item.Cells(1).Controls(0).ID)
            rqdTitle.Text = "*"

        End If

E.Item.Cells(1).Controls(0).ID is the textbox xontrol in the edit item on the datagrid which i want to validate.

When i click edit on an item i get the "The ControlToValidate property of '' cannot be blank. " so its obviously not seeing the control i want to validate.

As i say i would rather not go through changing all my required fields into template columns, so if there is a way to do it to a databound it would be great to know,
cheers

 
Old August 30th, 2004, 07:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Please post this in an ASP.NET forum.

 
Old September 3rd, 2004, 05:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Choose a forum from here to post this

DotNet
or
ASPX Beginners

_________________________
- Vijay G
Strive for Perfection
 
Old September 6th, 2004, 03:23 AM
Authorized User
 
Join Date: Feb 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks was already tipped off to this and have done so, read last reply,

 
Old September 6th, 2004, 03:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

oh, I didn't know about that. I was from vacation, and sort of replying and clearing all my old mails. Missed it somewhere.;)

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
required field validator rocksbhavesh ASP.NET 1.0 and 1.1 Basics 2 June 30th, 2007 03:20 AM
Required Field Validator RGB ASP.NET 1.0 and 1.1 Basics 3 March 31st, 2006 03:31 PM
Required Field Validator to a datagrid editt item dfalconer ASP.NET 1.0 and 1.1 Professional 9 September 2nd, 2004 02:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.