Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 June 16th, 2005, 09:11 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to validate Textbox input ?

Hi guys. I got a form that i ask the user to input data on it and it write it in sql server db. 2 of the field data i want their sum does not exceed a perticuler value for example 5 . How i can apply such bussiness rules in to my database and input form(at the client side). I be happy if some one show how to do this

http://i5.photobucket.com/albums/y18...07/sumform.jpg ( form pic)


insert code:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim MyCommand As SqlCommand

        Dim UpdateCmd As String = "Insert Into Matches Values(" & Me.TextBox1.Text & "," & Me.TextBox2.Text & "," & Me.LstPlayer.SelectedValue & "," & Me.TextBox4.Text & "," & Me.TextBox5.Text & ")"

        MyCommand = New SqlCommand(UpdateCmd, MyConnection)
        MyCommand.Connection.Open()
        MyCommand.ExecuteNonQuery()
        MyCommand.Connection.Close()
        Server.Transfer("Match.aspx")


    End Sub
 
Old June 16th, 2005, 10:50 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Use validation controls

 
Old June 16th, 2005, 11:46 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jbenson001
 Use validation controls

could u show me an example of validation controle?
 
Old June 16th, 2005, 12:43 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You could simply write:

If CInt(txtbox1.text) + CInt(txtbox2.text) > <some value?
   lblError.Text = "The sum cannot be greate than .. some value"
Else
   Write to DB
End If






Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript to validate a textbox abhishekkashyap27 Javascript 9 May 6th, 2008 02:41 AM
How do I validate file input? grstad Classic ASP Professional 1 February 18th, 2007 08:45 PM
hi help me to write javascript to validate textbox karthikc85 XML 1 October 12th, 2006 03:12 AM
Validate two textbox one for area code and number debjanib ASP.NET 1.0 and 1.1 Professional 1 June 6th, 2006 01:00 PM
validate textbox stoneman Access 5 January 30th, 2004 11:49 AM





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