Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 3rd, 2006, 09:10 AM
Authorized User
 
Join Date: Jan 2006
Location: gangtok, Sikkim, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default JavaScript Problem

Respected Sir,
                i seem to be having quite a problem trying to validate my asp.net webform...using javascript....My webform contains 2 textboxes and a button which is used to submit the form. (both the textboxes and button are webcontrols).... everytime i click the submit button i have called a javascript function in the aspx page using btn.Attributers.Add("onclick","functionName") ...if initially the txtboxes are empty...an alert is raised when i click the btn....which is what it shoul be doing....now if i fill both the textboxes after that and i click the button i still get the alert ...only if i click the button twice the alert goes away.... please could u tell me what the problem is...and give me a little advise on what i should do...the code that i have written is somethin like this


codebehind:(C#)
//let btn be button
//txt1 be textbox1
// txt2 be textbox2

private void Page_Load(Object sender,EventArgs e)
{
this.btn.Attributes.Add("onclick","validateFor m()");
}

protected void btn_Clicked(Object sender,EventArgs e)
{
if(txt1.Text==""||txt2.Text=="")
{
     string incompleteForm="<script>" +
                         "alert('Incomplete From')" +
                         "</script>"
}
else
{
     //connectToDatabase
}
}


achhetri
__________________
achhetri
  #2 (permalink)  
Old April 3rd, 2006, 10:26 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Use required field validators.

"The one language all programmers understand is profanity."
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Problem suresh_accudocs ASP.NET 1.0 and 1.1 Professional 1 July 24th, 2007 06:04 PM
problem with javascript padmaja3 Other Programming Languages 0 February 8th, 2007 02:56 AM
javascript problem dk6607 ASP.NET 1.0 and 1.1 Basics 10 October 2nd, 2006 12:56 PM
Javascript Problem dparsons ASP.NET 1.0 and 1.1 Basics 2 March 22nd, 2006 01:41 PM
Javascript problem highcliffevillage Javascript How-To 0 July 8th, 2004 07:13 AM



All times are GMT -4. The time now is 03:57 AM.


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