Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 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 November 11th, 2003, 11:22 AM
Authorized User
 
Join Date: Jul 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validating Template Text box

Hi

Is this programmatically feasible:

1) Here is the control

        <Columns>
          <asp:TemplateColumn HeaderText="Open Date">
            <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "OpenDate") %>
            </ItemTemplate>
            <EditItemTemplate>
              <asp:TextBox id="txtOpenDate" Size="25"
                   Text='<%# DataBinder.Eval(Container.DataItem,"OpenDate") %>'
                   runat="server"/>
            </EditItemTemplate>
          </asp:TemplateColumn>

2) And here is the validation element.
  Protected Sub ValidateData(Source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs)
     args.IsValid = False
         Dim date_open As Date

        Try
            date_open = Date.Parse(txtOpenDate.Text)
      Catch ex As Exception
            feedbackLabel.Text = "Invalid data entry: Depature date is Invalid. " _
                   + "Enter a valid date, for example: 2003/01/02"
         Return
    End Try
     args.IsValid = True
  End Sub

When I try it I get an error saying txtOpenDate.Text is undeclared even though txtOpenDate is a textbox ID.

Am I missing the point?

Thanks








Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating a text box maitias C# 2005 2 March 25th, 2007 01:52 AM
[:D]Simple Method of Validating text boxes[:D] samnikh VB Databases Basics 0 June 29th, 2005 09:26 PM
Validating Text in JText javanewbie05 Java GUI 3 June 23rd, 2005 08:35 AM
validating rich text field for attachment Mimi Javascript How-To 4 August 25th, 2003 03:12 AM





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