473,320 Members | 1,955 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,320 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 2533

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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.