Need to validate the Textbox value with database columm value

Working with ASP.NET 2.0 i have a textbox say txt1 for entering the date and a column in database for date.I need to validate the txt1 vaalue with the database value ,if txt1 date doesn't exist in the database i want to warn the user (Date doesnt Exist) either on textbox change event or on button click.

How can i do this.....

5/18/2007 2:11:21 PM 93655 articles. 4 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 58

I would have a textbox, a label and a button. Then on the onClick event handler for the button I would have the code where the search in the DB is being made and if I receive any rows, modify the Text property of the label to say something like "Date exists". If there aren't any rows in the DB, modify the Text property of the label to say something like "Date doesn't exist".

Hope this helps. 

German Afanador
5/18/2007 2:23:58 PM

You need to use a CustomValidator and you'd validate the date in the CustomValidator's code during PostBack.

5/18/2007 2:24:02 PM

I'd put code in the Text Changed event for the textbox that makes a call to the DB and checks to see if the date exists.  This will fire when the person pressed Enter after changing the text or the textbox loses focus after the person entered a date, so it'll fire right after they make their change.  If it doesn't, it can warm the user with a message box or error message on the page.  You might even be able to do this in client-side server script to save a post-back to the server, but I've never tried that before.

5/18/2007 4:03:45 PM

Similar Artilces:

Populating TextBox Value with Values Retrieved From Database
Hi. I recently encounted a problem and was hoping you all here can help me. You see. I wanted to create an administrative section where the administrator can edit an existing News entry. I didn't want to use DataGrid because the content of each News entry is going to be extremely long and would screw up the whole DataGrid. What I did was create a form with TextBoxes for the Date Posted and Title and Content of the News entry. Then, on Page_Load, the ASP.Net page will do a SELECT query to retrieve the data for the selected New entry and fill the TextBoxes accordingly. The problem is,...

check textbox values with oracle database values
 how to check textbox values with oracle database values for setting username and password You need with your query add parameters. We All move to our original place.Don't forget.Imran Baloch...

validating textbox value with database
Here's what I am trying to do but have been successful:-user enters in ID-value is validated against Access database to see if ID exists-if ID exists then information is displayed-if ID does not exist--error message is displayed. Please let me know how I should start the code. Thanks! The first thing would be to check the database for the id by searching the field in the table where the id exists....your sql select statement would be something like : "select * from tablename where ID=" & txtID.text then, merely display the data or whatever message you want.David WierMCP/ASPIns...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

Need value for DropDownList Listitem to return all values in database
Hi All, Many thanks for all the help thus far.  In short, here's my problem: I am passing controlparameters (from DropDownLists) to my SELECT statement.  Here's the DropDropDownList: <asp:DropDownList id="status_DropDownList" runat="server"><asp:ListItem Value="Open">Open</asp:ListItem><asp:ListItem Value="Closed">Closed</asp:ListItem><asp:ListItem Value= ??? > Get ALL records </asp:ListItem></asp:DropDownList> What value would I assign the Get All records that would return...

Comparing values inputted in textboxes to values stored in database
Hello all, I am currently experiencing difficulty with the following;  I am trying to compare the values in my web form to those values stored in the database.  For example; on my web page a user inputs a temperature figure into the textbox.  I want to compare this figure to certain figures stored in the database.I am using c# and visual studio 2005 with SQL Express.  Any help would be great.  I am not sure where to start. I don't want to hard code the figures into my code either. Any help or links would be of great benefit.  I thank you for your t...

Losing values of Textboxes after accessing values from web.config
HelloCan someone help with me with this problem. I am accessing some values from my application's web.config in the AppSettings section and setting the text properties of the text boxes on a settings page with these values. I then edit the value of one of the text boxes. When I click the Save Changes button I lose the values of these text boxes. The code I am using is: In Page_Load:txtSMTPServerURL.Text = ConfigurationManager.AppSettings["SMTPServerURL"] In btnSaveChanges_Click:string smtpURL = txtSMTPServerURL.Text Andrew Ling Are you checking for a postback (Page.IsPost...

hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

Drop down list in Form view returns error when value in bound field (data binding
I get the following error when I click edit to edit the details in the web form:'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value  I would like it to accept any value which currently exists in the database. Is this easily achievable? With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.~ Timwww.bucketo...

form textboxes: How to programmically Validate the values
 Hi, I changing a form with lots of textboxes for the user to enter the profile information. I databinded each of the textbox to the profileobject. In Windows form, when you leave or change the textbox values, you can call the property to set the value. How do I do that with web form where the set call in each property of the profile object? Or programmically call a method to validate all the textbox values? Any help is appreciated by this newbie,Thanks.    protected void SubmitButton_Click(Object sender, EventArgs e)  {      Label ...

how to retrive the values entered in a dynamic textbox and enter those values to database
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;   public partial class CSharp : System.Web.UI.Page { Panel pnlTextBox; Panel pnlDropDownList; protected void Page_Load(object sender, EventArgs e) { Literal lt; Label lb; //Dynamic TextBox Panel pnlTextBox = new Panel(); pnlTextBox.ID = "pnlTextBox"; pnlTextBox.BorderWidth = 1; pnlTextBox.Width = 300; this.form1.Controls...

Need to assign a value from the database to TextBox
Hi, I am running a SELECT * FROM Customers (QUERY) And now i need to bind the FirstName to the TextBox how can I so that. Here is my code private void LoadCustomerDetails(int CustomerID) { //OleDbCommand myCommand = new OleDbCommand("SELECT * FROM Customers",myConection); //myCommand.CommandType = CommandType.Text; OleDbDataAdapter ad = new OleDbDataAdapter("SELECT * FROM Customers WHERE CustomerID="+CustomerID,myConnection); DataSet ds = new DataSet(); ad.Fill(ds); txtFirstName.Text = ds.Ta...

check if two values are unique... if one value is form the database
Hi My question has to do with using an if statement, or an "is unique" kinda statement to figure out if two values are distinct from each other. One value will be a session and the other will be pulled from an sql database. I am using vb and anyone can tell me how to use the if statement with a database value... such as #Eval that would be awesome.A sample of the code is:<% if Session("this_value") = Eval("Name") then response.write("they are the same") end if %> I appreciate any correspondence You have to retieve the value...

How to set a dropdown value in a form based on a value read from a database?
We wish to populate a form based on information read from our database.One of the controls is a dropdown list. We first fill up the ddl from a table of about 60 values. Then we read a value from a different table that was saved data earlier to see which of the 60 values was picked. We wish to show the user that value in the dropdownlist when we display the form. How can we do this?For example, we fill the dropdown list with school course codes (French, German, Math, etc.) , then wish to read a different table in the database and select the dropdown item based on what we r...

Web resources about - Need to validate the Textbox value with database columm value -

Credit Card Validate on the App Store on iTunes
Get Credit Card Validate on the App Store. See screenshots and ratings, and read customer reviews.

Who Is Going to Shoot Obama? Paul Broun Chuckles, Validates Question - YouTube
Republican Congressman from George Paul Broun chuckles and does not even come close to denouncing a question asked by a constituent at a town ...

PM says MH370 debris find 'validates search'
Experts say recovered MH370 debris is consistent the area being searched in the southern Indian Ocean.

Spain's domination of England validates the Socceroos' search for identity
It is incredible to think that with all the billions of dollars of resources in the English game, their solitary success remains almost 50 years ...

Fracking report validates environmental concerns in N.W.T.
... Kenyon of the Pembina Institute. A director of the Pembina Institute in Edmonton says a new report on the risks of shale gas development validates ...

【medical-news】Study First to Validate That Singing Can Help People Learn a Foreign Language - 医药生命科学动态跟踪 ...
只是新闻而已Fernanda Ferreira’s family emigrated from Portugal to Canada when she was very young. There, like most Canadian children, she learned French ...

Supreme court validates private loans for rightful purposes
Supreme court validates private loans for rightful purposes

IXIA : Selected by China Network World to Validate High-Performance Cisco ...
IXIA : Selected by China Network World to Validate High-Performance Cisco ... 4-traders (press release) BEIJING - June 25, 2013 - Ixia (Nasdaq: ...

Apple Watch uses constant skin contact to validate Apple Pay purchases
... will the device make sure payments via Apple Pay are secure? Both the iPhone 6 and iPhone 6 Plus have the convenient Touch ID sensor to validate ...

Like You Really Need To Validate Your Social Media Presence….
How many Fortune 500 companies are blogging and using social media, and what can law firms learn from them?

Resources last updated: 12/8/2015 5:43:06 PM