The problem is that your basic premise is wrong. It is wrong because
your understanding of the ASP.NET page lifecycle is amiss. I say your
understanding is amiss because you need to understand that ASP.NET
code executes on the server and the HTML output is sent to the client
browser. Alerts are javascript functions that are executed by the
browser solely on the client. When you use the RegisterStartupScript
method, it just tells ASP.NET to include that script segment in the
HTML that it is going to send to the client. Since the server does not
execute the "alert", you cannot terminate execution immediately after
the alert is displayed, because your subsequent code has already been
executed.
On Aug 29, 10:13 am, abhinandan <[EMAIL PROTECTED]> wrote:
> Hello All,
> I have 2 textbox,consider txtbox1 and txtbox2.I have 2 buttons
> next to these textboxes,Consider btn1 and btn2.
>
> [ txtbox1 ] ( btn1 )
>
> [ txtbox2 ] ( btn2 )
>
> When i click btn2 it will check if ttbox1 is empty or not and will
> display a error message(alert) else will process.
>
> i want to stop the processing after the alert message is displayed.how
> do i do it?
>
> protected void btn2_click( sender , e)
> {
> if( txtbox1 == "")
> {
> scriptmanager.RegisterStartupScript(this.page,typeof(String),"error","alert('textbox
> should not be empty');",true);
>
> /// I want to stop the processing here.I tried Response.End(),Break,
> didnt work.Any solution?
>
> }
>
> else
> {
> /// processes the code here
>
> }
> }
>
> Regards,
> S.S.Abhinandan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---