Connecting Tech Pros Worldwide Forums | Help | Site Map

Message Boxes to Browser for Code Behind

Troy Whitlow
Guest
 
Posts: n/a
#1: Nov 18 '05
I am developing a web application using aspx web forms and
would like to send message boxes to the client browser
when certain conditions and checks are performed.

************************************************** *******
Example:

Try

Perform some actions

Catch ex as system.exception ' Actions failed

I would like to send the error to the screen in the form
of a messagebox on the client browser

End try

************************************************** ******

Additionally, I would like to be able to prompt a
messagebox to ask questions and then process based on the
response. Similar to do you want to delete all the records
selected prompt on a yes choice then delete the records on
a no choice cancel.

All of my server code is in the Code Behind pages for each
of my aspx pages. Basically all the display is in the aspx
and all the code is in the code behind.

Any help would be greatly appreciated, especially any
sample code examples. This is my first application using
aspx. I have been writing windows apps and windows
services, but the web provides for some additional
challenges.

Troy Whitlow


Curt_C [MVP]
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Message Boxes to Browser for Code Behind


Nope....
You can only do this by stopping all processing, sending everythign to the
client and waiting for another post-back/round-trip to the server for the
next step....
All the server processing is done before the client gets it's chance to
interact

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Troy Whitlow" <troy.whitlow@hp.com> wrote in message
news:017001c3d6db$386e4b00$a301280a@phx.gbl...[color=blue]
> I am developing a web application using aspx web forms and
> would like to send message boxes to the client browser
> when certain conditions and checks are performed.
>
> ************************************************** *******
> Example:
>
> Try
>
> Perform some actions
>
> Catch ex as system.exception ' Actions failed
>
> I would like to send the error to the screen in the form
> of a messagebox on the client browser
>
> End try
>
> ************************************************** ******
>
> Additionally, I would like to be able to prompt a
> messagebox to ask questions and then process based on the
> response. Similar to do you want to delete all the records
> selected prompt on a yes choice then delete the records on
> a no choice cancel.
>
> All of my server code is in the Code Behind pages for each
> of my aspx pages. Basically all the display is in the aspx
> and all the code is in the code behind.
>
> Any help would be greatly appreciated, especially any
> sample code examples. This is my first application using
> aspx. I have been writing windows apps and windows
> services, but the web provides for some additional
> challenges.
>
> Troy Whitlow
>[/color]


Steve C. Orr [MVP, MCSD]
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Message Boxes to Browser for Code Behind


Execute a line of code like this when you want a message box to be
displayed.
(This writes out the necessary client side javascript to your HTML page to
make the alert pop up as soon as the page is sent to their browser.)

RegisterStartupScript("startupScript", "<script
language=JavaScript>alert('This is my message.');</script>");

Here's more info:
http://msdn.microsoft.com/library/de...criptTopic.asp

Here are a couple controls you might find to be useful:
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
http://www.jttz.com/msgbox/index.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"Troy Whitlow" <troy.whitlow@hp.com> wrote in message
news:017001c3d6db$386e4b00$a301280a@phx.gbl...[color=blue]
> I am developing a web application using aspx web forms and
> would like to send message boxes to the client browser
> when certain conditions and checks are performed.
>
> ************************************************** *******
> Example:
>
> Try
>
> Perform some actions
>
> Catch ex as system.exception ' Actions failed
>
> I would like to send the error to the screen in the form
> of a messagebox on the client browser
>
> End try
>
> ************************************************** ******
>
> Additionally, I would like to be able to prompt a
> messagebox to ask questions and then process based on the
> response. Similar to do you want to delete all the records
> selected prompt on a yes choice then delete the records on
> a no choice cancel.
>
> All of my server code is in the Code Behind pages for each
> of my aspx pages. Basically all the display is in the aspx
> and all the code is in the code behind.
>
> Any help would be greatly appreciated, especially any
> sample code examples. This is my first application using
> aspx. I have been writing windows apps and windows
> services, but the web provides for some additional
> challenges.
>
> Troy Whitlow
>[/color]


Curt_C [MVP]
Guest
 
Posts: n/a
#4: Nov 18 '05

re: Message Boxes to Browser for Code Behind


Does this get sent prior to the rest of the serverside code processing
though? If it does that would be kewl....but I didn't think it did?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
news:OlgDwAv1DHA.3116@TK2MSFTNGP11.phx.gbl...[color=blue]
> Execute a line of code like this when you want a message box to be
> displayed.
> (This writes out the necessary client side javascript to your HTML page to
> make the alert pop up as soon as the page is sent to their browser.)
>
> RegisterStartupScript("startupScript", "<script
> language=JavaScript>alert('This is my message.');</script>");
>
> Here's more info:
>[/color]
http://msdn.microsoft.com/library/de...criptTopic.asp[color=blue]
>
> Here are a couple controls you might find to be useful:
> http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
> http://www.jttz.com/msgbox/index.htm
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
> Hire top-notch developers at http://www.able-consulting.com
>
>
>
> "Troy Whitlow" <troy.whitlow@hp.com> wrote in message
> news:017001c3d6db$386e4b00$a301280a@phx.gbl...[color=green]
> > I am developing a web application using aspx web forms and
> > would like to send message boxes to the client browser
> > when certain conditions and checks are performed.
> >
> > ************************************************** *******
> > Example:
> >
> > Try
> >
> > Perform some actions
> >
> > Catch ex as system.exception ' Actions failed
> >
> > I would like to send the error to the screen in the form
> > of a messagebox on the client browser
> >
> > End try
> >
> > ************************************************** ******
> >
> > Additionally, I would like to be able to prompt a
> > messagebox to ask questions and then process based on the
> > response. Similar to do you want to delete all the records
> > selected prompt on a yes choice then delete the records on
> > a no choice cancel.
> >
> > All of my server code is in the Code Behind pages for each
> > of my aspx pages. Basically all the display is in the aspx
> > and all the code is in the code behind.
> >
> > Any help would be greatly appreciated, especially any
> > sample code examples. This is my first application using
> > aspx. I have been writing windows apps and windows
> > services, but the web provides for some additional
> > challenges.
> >
> > Troy Whitlow
> >[/color]
>
>[/color]


Steve C. Orr [MVP, MCSD]
Guest
 
Posts: n/a
#5: Nov 18 '05

re: Message Boxes to Browser for Code Behind


No, normally this gets sent along to the client along with all the other
server generated HTML & script after all the serverside code processing is
complete. Although you should be able to use Response.Write to send the
javascript out immediately if this is what you want - as long as you turn
buffering off.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:OpqcFDv1DHA.3416@tk2msftngp13.phx.gbl...[color=blue]
> Does this get sent prior to the rest of the serverside code processing
> though? If it does that would be kewl....but I didn't think it did?
>
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> www.Darkfalz.com
>
>
> "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
> news:OlgDwAv1DHA.3116@TK2MSFTNGP11.phx.gbl...[color=green]
> > Execute a line of code like this when you want a message box to be
> > displayed.
> > (This writes out the necessary client side javascript to your HTML page[/color][/color]
to[color=blue][color=green]
> > make the alert pop up as soon as the page is sent to their browser.)
> >
> > RegisterStartupScript("startupScript", "<script
> > language=JavaScript>alert('This is my message.');</script>");
> >
> > Here's more info:
> >[/color]
>[/color]
http://msdn.microsoft.com/library/de...criptTopic.asp[color=blue][color=green]
> >
> > Here are a couple controls you might find to be useful:
> > http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
> > http://www.jttz.com/msgbox/index.htm
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://Steve.Orr.net
> > Hire top-notch developers at http://www.able-consulting.com
> >
> >
> >
> > "Troy Whitlow" <troy.whitlow@hp.com> wrote in message
> > news:017001c3d6db$386e4b00$a301280a@phx.gbl...[color=darkred]
> > > I am developing a web application using aspx web forms and
> > > would like to send message boxes to the client browser
> > > when certain conditions and checks are performed.
> > >
> > > ************************************************** *******
> > > Example:
> > >
> > > Try
> > >
> > > Perform some actions
> > >
> > > Catch ex as system.exception ' Actions failed
> > >
> > > I would like to send the error to the screen in the form
> > > of a messagebox on the client browser
> > >
> > > End try
> > >
> > > ************************************************** ******
> > >
> > > Additionally, I would like to be able to prompt a
> > > messagebox to ask questions and then process based on the
> > > response. Similar to do you want to delete all the records
> > > selected prompt on a yes choice then delete the records on
> > > a no choice cancel.
> > >
> > > All of my server code is in the Code Behind pages for each
> > > of my aspx pages. Basically all the display is in the aspx
> > > and all the code is in the code behind.
> > >
> > > Any help would be greatly appreciated, especially any
> > > sample code examples. This is my first application using
> > > aspx. I have been writing windows apps and windows
> > > services, but the web provides for some additional
> > > challenges.
> > >
> > > Troy Whitlow
> > >[/color]
> >
> >[/color]
>
>[/color]


Curt_C [MVP]
Guest
 
Posts: n/a
#6: Nov 18 '05

re: Message Boxes to Browser for Code Behind


Still need the Response.Flush() calls like in classic ASP?

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
news:udiUaIv1DHA.1704@tk2msftngp13.phx.gbl...[color=blue]
> No, normally this gets sent along to the client along with all the other
> server generated HTML & script after all the serverside code processing is
> complete. Although you should be able to use Response.Write to send the
> javascript out immediately if this is what you want - as long as you turn
> buffering off.
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
> Hire top-notch developers at http://www.able-consulting.com
>
>
>
> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> news:OpqcFDv1DHA.3416@tk2msftngp13.phx.gbl...[color=green]
> > Does this get sent prior to the rest of the serverside code processing
> > though? If it does that would be kewl....but I didn't think it did?
> >
> > --
> > Curt Christianson
> > Owner/Lead Developer, DF-Software
> > www.Darkfalz.com
> >
> >
> > "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
> > news:OlgDwAv1DHA.3116@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Execute a line of code like this when you want a message box to be
> > > displayed.
> > > (This writes out the necessary client side javascript to your HTML[/color][/color][/color]
page[color=blue]
> to[color=green][color=darkred]
> > > make the alert pop up as soon as the page is sent to their browser.)
> > >
> > > RegisterStartupScript("startupScript", "<script
> > > language=JavaScript>alert('This is my message.');</script>");
> > >
> > > Here's more info:
> > >[/color]
> >[/color]
>[/color]
http://msdn.microsoft.com/library/de...criptTopic.asp[color=blue][color=green][color=darkred]
> > >
> > > Here are a couple controls you might find to be useful:
> > > http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
> > > http://www.jttz.com/msgbox/index.htm
> > >
> > > --
> > > I hope this helps,
> > > Steve C. Orr, MCSD, MVP
> > > http://Steve.Orr.net
> > > Hire top-notch developers at http://www.able-consulting.com
> > >
> > >
> > >
> > > "Troy Whitlow" <troy.whitlow@hp.com> wrote in message
> > > news:017001c3d6db$386e4b00$a301280a@phx.gbl...
> > > > I am developing a web application using aspx web forms and
> > > > would like to send message boxes to the client browser
> > > > when certain conditions and checks are performed.
> > > >
> > > > ************************************************** *******
> > > > Example:
> > > >
> > > > Try
> > > >
> > > > Perform some actions
> > > >
> > > > Catch ex as system.exception ' Actions failed
> > > >
> > > > I would like to send the error to the screen in the form
> > > > of a messagebox on the client browser
> > > >
> > > > End try
> > > >
> > > > ************************************************** ******
> > > >
> > > > Additionally, I would like to be able to prompt a
> > > > messagebox to ask questions and then process based on the
> > > > response. Similar to do you want to delete all the records
> > > > selected prompt on a yes choice then delete the records on
> > > > a no choice cancel.
> > > >
> > > > All of my server code is in the Code Behind pages for each
> > > > of my aspx pages. Basically all the display is in the aspx
> > > > and all the code is in the code behind.
> > > >
> > > > Any help would be greatly appreciated, especially any
> > > > sample code examples. This is my first application using
> > > > aspx. I have been writing windows apps and windows
> > > > services, but the web provides for some additional
> > > > challenges.
> > > >
> > > > Troy Whitlow
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Steve C. Orr [MVP, MCSD]
Guest
 
Posts: n/a
#7: Nov 18 '05

re: Message Boxes to Browser for Code Behind


Not sure off the top of my head, but it would be easy enough to test.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uaZZuqv1DHA.2180@TK2MSFTNGP12.phx.gbl...[color=blue]
> Still need the Response.Flush() calls like in classic ASP?
>
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> www.Darkfalz.com
>
>
> "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
> news:udiUaIv1DHA.1704@tk2msftngp13.phx.gbl...[color=green]
> > No, normally this gets sent along to the client along with all the other
> > server generated HTML & script after all the serverside code processing[/color][/color]
is[color=blue][color=green]
> > complete. Although you should be able to use Response.Write to send the
> > javascript out immediately if this is what you want - as long as you[/color][/color]
turn[color=blue][color=green]
> > buffering off.
> >
> > --
> > I hope this helps,
> > Steve C. Orr, MCSD, MVP
> > http://Steve.Orr.net
> > Hire top-notch developers at http://www.able-consulting.com
> >
> >
> >
> > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> > news:OpqcFDv1DHA.3416@tk2msftngp13.phx.gbl...[color=darkred]
> > > Does this get sent prior to the rest of the serverside code processing
> > > though? If it does that would be kewl....but I didn't think it did?
> > >
> > > --
> > > Curt Christianson
> > > Owner/Lead Developer, DF-Software
> > > www.Darkfalz.com
> > >
> > >
> > > "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
> > > news:OlgDwAv1DHA.3116@TK2MSFTNGP11.phx.gbl...
> > > > Execute a line of code like this when you want a message box to be
> > > > displayed.
> > > > (This writes out the necessary client side javascript to your HTML[/color][/color]
> page[color=green]
> > to[color=darkred]
> > > > make the alert pop up as soon as the page is sent to their browser.)
> > > >
> > > > RegisterStartupScript("startupScript", "<script
> > > > language=JavaScript>alert('This is my message.');</script>");
> > > >
> > > > Here's more info:
> > > >
> > >[/color]
> >[/color]
>[/color]
http://msdn.microsoft.com/library/de...criptTopic.asp[color=blue][color=green][color=darkred]
> > > >
> > > > Here are a couple controls you might find to be useful:
> > > > http://www.metabuilders.com/Tools/ConfirmedButtons.aspx
> > > > http://www.jttz.com/msgbox/index.htm
> > > >
> > > > --
> > > > I hope this helps,
> > > > Steve C. Orr, MCSD, MVP
> > > > http://Steve.Orr.net
> > > > Hire top-notch developers at http://www.able-consulting.com
> > > >
> > > >
> > > >
> > > > "Troy Whitlow" <troy.whitlow@hp.com> wrote in message
> > > > news:017001c3d6db$386e4b00$a301280a@phx.gbl...
> > > > > I am developing a web application using aspx web forms and
> > > > > would like to send message boxes to the client browser
> > > > > when certain conditions and checks are performed.
> > > > >
> > > > > ************************************************** *******
> > > > > Example:
> > > > >
> > > > > Try
> > > > >
> > > > > Perform some actions
> > > > >
> > > > > Catch ex as system.exception ' Actions failed
> > > > >
> > > > > I would like to send the error to the screen in the form
> > > > > of a messagebox on the client browser
> > > > >
> > > > > End try
> > > > >
> > > > > ************************************************** ******
> > > > >
> > > > > Additionally, I would like to be able to prompt a
> > > > > messagebox to ask questions and then process based on the
> > > > > response. Similar to do you want to delete all the records
> > > > > selected prompt on a yes choice then delete the records on
> > > > > a no choice cancel.
> > > > >
> > > > > All of my server code is in the Code Behind pages for each
> > > > > of my aspx pages. Basically all the display is in the aspx
> > > > > and all the code is in the code behind.
> > > > >
> > > > > Any help would be greatly appreciated, especially any
> > > > > sample code examples. This is my first application using
> > > > > aspx. I have been writing windows apps and windows
> > > > > services, but the web provides for some additional
> > > > > challenges.
> > > > >
> > > > > Troy Whitlow
> > > > >
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Lostinet.Web Support
Guest
 
Posts: n/a
#8: Nov 18 '05

re: Message Boxes to Browser for Code Behind


you can use my free control 'ControlHelper' to popup
Alert,Confirm,Prompt,Dialog !

http://www.lostinet.com/en/lwsamplecs/

you can download it and use it for free .

I think you will be shocked after you know you needn't write javascript code
any more

--
http://www.lostinet.com/
---------------------------
Lostinet.Web Controls&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
---------------------------
It's FREE !!
---------------------------
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

"Troy Whitlow" <troy.whitlow@hp.com> ????
news:017001c3d6db$386e4b00$a301280a@phx.gbl...[color=blue]
> I am developing a web application using aspx web forms and
> would like to send message boxes to the client browser
> when certain conditions and checks are performed.
>
> ************************************************** *******
> Example:
>
> Try
>
> Perform some actions
>
> Catch ex as system.exception ' Actions failed
>
> I would like to send the error to the screen in the form
> of a messagebox on the client browser
>
> End try
>
> ************************************************** ******
>
> Additionally, I would like to be able to prompt a
> messagebox to ask questions and then process based on the
> response. Similar to do you want to delete all the records
> selected prompt on a yes choice then delete the records on
> a no choice cancel.
>
> All of my server code is in the Code Behind pages for each
> of my aspx pages. Basically all the display is in the aspx
> and all the code is in the code behind.
>
> Any help would be greatly appreciated, especially any
> sample code examples. This is my first application using
> aspx. I have been writing windows apps and windows
> services, but the web provides for some additional
> challenges.
>
> Troy Whitlow
>[/color]


Closed Thread