Cerebrus
unread,Aug 29, 2008, 4:30:54 AM8/29/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
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 <
abhinanda...@gmail.com> 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