473,387 Members | 1,650 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,387 software developers and data experts.

Page.IsValid

I have a form with a Serial No and Pin text box which are validated with
required field validators. Once they are validated my code goes to a
btn_Click event and if Page.IsValid then checks to see if the Serial No
and Pin is in a database table.

My problem is that once the user has entered details in the Serial No
and Pin boxes making Page.IsValid true, when I clear these text boxes
Page.IsVaild still seems to be true, because my Page.IsValid code still
executes and tells the user that their Serial No/Pin does not exist, as
well as telling the user that they need to enter stuff in the text
boxes. This is my code :

public void btnSubmit_Click(object sender, EventArgs e)
{
feedbackLabel.Text = "";

if (Page.IsValid)
{
string strSerialNumber, strPinNumber, strSQL;

strSerialNumber = SerialNumber.Text.Trim();
strPinNumber = PinNumber.Text.Trim();
strSQL = "SELECT * FROM purple_cards WHERE serial = '" +
strSerialNumber + "' AND PIN = '" + strPinNumber + "'";

SqlConnection objConnection = new
SqlConnection(ConfigurationSettings.AppSettings["strConnect"]);
SqlDataReader objDataReader = null;
SqlCommand objCommand = new SqlCommand(strSQL,
objConnection);

try
{
objConnection.Open();
objDataReader = objCommand.ExecuteReader();

if (objDataReader.Read() == true)
{
feedbackLabel.Text = "Record found";
}
else
{
feedbackLabel.Text = "Record not found";
}
}
catch
{
feedbackLabel.Text = "Connection failed to open
successfully";
}
}
}

Has anybody else had this problem?
Any help would be really appreciated.
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
0 2536

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

Similar topics

1
by: Matthias Lohrer | last post by:
Hi, I'm playing around with the possibilities of Page.ParseControl. I parse a string with an input-field and an RequiredFieldValidator-control. For testing the server-side validation I disable...
5
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be...
1
by: Liz | last post by:
I have a page with several dropdownlists, several text boxes and several buttons which perform calculations. I need to validate one dropdownlist (not the whole page) with the click of one button. I...
0
by: Martin | last post by:
Hi, I wanted to preform my own custom validation for the entire page so i though I would implemet the IValidator interface and do all of my validation in the "Validate" method, and this works...
6
by: Mike Chen | last post by:
We know in server code, we can check the page validated by using Page.IsValid where we put some validator controls on aspx page. I want to set some value after validating user input values on...
7
by: tshad | last post by:
I have a page that is showing as: Page.IsValid = False on postback when my submit button is pressed but none of my Validators have fired so there is no error message. How do I find out what...
3
by: Andrew Jocelyn | last post by:
Hi I have couple of dropdown controls each with a requiredfieldvalidator. I clear the dropdownlist in the button click event. When the page is rendered the dropdown validator already flags it's...
2
by: =?Utf-8?B?R2FyeSBMYXJpbWVy?= | last post by:
I an asp.net web page with a simple form and a Submit button. Form entries are validated client side, but as a back up I would also like to validate server side, but not sure where to do it code....
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.