Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Alerting the user from code behind

Reply
Thread Tools

Alerting the user from code behind

 
 
Peter Aitken
Guest
Posts: n/a
 
      07-31-2004
I need to alert the user when code behind in a user control encounters
certain data conditions. I'd like to do this with a MsgBox but I know that
code behind cannot call this function, at least not directly. Is there a way
to do this?

--
Peter Aitken

Remove the crap from my email address before using.


 
Reply With Quote
 
 
 
 
Peter Aitken
Guest
Posts: n/a
 
      07-31-2004
"Peter Aitken" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I need to alert the user when code behind in a user control encounters
> certain data conditions. I'd like to do this with a MsgBox but I know that
> code behind cannot call this function, at least not directly. Is there a

way
> to do this?
>
> --


To answer my own question

Response.write("<script>alert("The message")</script">)


--
Peter Aitken

Remove the crap from my email address before using.


 
Reply With Quote
 
 
 
 
Adam Kinney
Guest
Posts: n/a
 
      08-02-2004
I would suggest using a Register method of the Page Class instead. You gain
more control of where the javascript is added to the page and you ensure the
javascript is only added once.

RegisterStartupScript -
http://msdn.microsoft.com/library/de...criptTopic.asp

RegisterClientScriptBlock -
http://msdn.microsoft.com/library/de...asp?frame=true


Adam Kinney
http://www.adamkinney.com


"Peter Aitken" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Peter Aitken" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > I need to alert the user when code behind in a user control encounters
> > certain data conditions. I'd like to do this with a MsgBox but I know

that
> > code behind cannot call this function, at least not directly. Is there a

> way
> > to do this?
> >
> > --

>
> To answer my own question
>
> Response.write("<script>alert("The message")</script">)
>
>
> --
> Peter Aitken
>
> Remove the crap from my email address before using.
>
>



 
Reply With Quote
 
Peter Aitken
Guest
Posts: n/a
 
      08-02-2004
"Adam Kinney" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would suggest using a Register method of the Page Class instead. You

gain
> more control of where the javascript is added to the page and you ensure

the
> javascript is only added once.
>
> RegisterStartupScript -
>

http://msdn.microsoft.com/library/de...criptTopic.asp
>
> RegisterClientScriptBlock -
>

http://msdn.microsoft.com/library/de...asp?frame=true
>
>
> Adam Kinney
> http://www.adamkinney.com
>
>



Thanks, Adam. When would you use the Client version versus the Startup
version?

--
Peter Aitken

Remove the crap from my email address before using.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
[ANN] RCAP 1.0.0 - Common Alerting Protocol for Ruby Farrel Lifson Ruby 0 04-06-2011 08:30 PM
Alerting Chinese characters - can it be done? Laser Lips Javascript 8 07-06-2010 02:04 PM
RCAP - Common Alerting Protocl for Ruby Farrel Lifson Ruby 1 11-03-2009 08:38 PM
Cisco 500-24 switch alerting on half duplex? edavid3001@gmail.com Cisco 2 11-16-2005 09:34 PM
Sample for Alerting user susie ASP .Net Web Controls 1 12-03-2003 04:09 AM



Advertisments