PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 1.00 average.

ASP.NET C# code behind call javascript alert then execute next lin

 
 
JB
Guest
Posts: n/a
 
      1st Aug 2010
Hello Community

Using ASP.NET, C# and SQLServer code behind checks whether data
is entered into textbox.

If data was entered into a textbox then the next line of code executes.

If data was not entered into a textbox then I want to call a javascript
alert from the code behind that tells the user to enter data into the textbox
then executes the next line of code in the code behind.

I can use Response.Write to do that but it is not acceptable in this
case because the alert must appear on the same page.

How can I call a javascript alert from within my web page code behind
and still
execute the next line of the code in the code behind after calling the
javascript alert
has been called?

Thanks
Jeff
--
JB
 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      2nd Aug 2010
On 8/1/2010 4:53 PM, JB wrote:
> Hello Community
>
> Using ASP.NET, C# and SQLServer code behind checks whether data
> is entered into textbox.
>
> If data was entered into a textbox then the next line of code executes.
>
> If data was not entered into a textbox then I want to call a javascript
> alert from the code behind that tells the user to enter data into the textbox
> then executes the next line of code in the code behind.
>
> I can use Response.Write to do that but it is not acceptable in this
> case because the alert must appear on the same page.
>
> How can I call a javascript alert from within my web page code behind
> and still
> execute the next line of the code in the code behind after calling the
> javascript alert
> has been called?
>


This link may help you.

<http://archive.devnewz.com/devnewz-3-20061129JavaScriptAlertShowmessagefromASPNETCodebehind.html>
 
Reply With Quote
 
Cubaman
Guest
Posts: n/a
 
      2nd Aug 2010
On Aug 1, 10:53*pm, JB <J...@discussions.microsoft.com> wrote:
> Hello Community
>
> * * Using ASP.NET, C# and SQLServer code behind checks whether data
> is entered into textbox. *
>
> * * If data was entered into a textbox then the next line of code executes. *
>
> * * If data was not entered into a textbox then I want to call a javascript
> alert from the code behind that tells the user to enter data into the textbox
> then executes the next line of code in the code behind.
>
> * * I can use Response.Write to do that but it is not acceptable in this
> case because the *alert must appear on the same page.
>
> * * How can I call a javascript alert from within my web page code behind
> and still
> execute the next line of the code in the code behind after calling the
> javascript alert
> has been called?
>
> * * Thanks
> * * Jeff
> --
> JB


ClientScript.RegisterStartupscript(Type, Script, bool)
http://msdn.microsoft.com/en-us/library/aa479390.aspx

Also you can get the same results using asp.net validation controls..

http://www.w3schools.com/aspnet/aspn...oncontrols.asp

Best regards
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Execute JavaScript in VBA Code? Gary Microsoft Access VBA Modules 3 13th Jan 2010 06:20 AM
call javascript from code behind Mike Microsoft ASP .NET 2 4th Oct 2007 04:30 PM
Display a javascript alert in an ajax call Jeremy Microsoft ASP .NET 3 18th Sep 2007 08:53 PM
Call VB Code Behind Function from JavaScript??? jason.gyetko@epower-inc.com Microsoft ASP .NET 5 30th Jun 2006 06:51 PM
button to only execute javascript and not postback (using code behind) Marcel Balcarek Microsoft ASP .NET 4 5th Dec 2003 06:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:28 AM.