Can I use Msgbox function in ASP.NET ?

Reply

Join Date: Mar 2008
Posts: 324
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Re: Can I use Msgbox function in ASP.NET ?

 
-1
  #11
Sep 14th, 2009
hello dnanetwork , how r u ? Have u blocked,dat nobody can send u privat message?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 123
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Can I use Msgbox function in ASP.NET ?

 
0
  #12
Sep 14th, 2009
  1. Create a class and add these two methods to it :
  2.  
  3. // for postback events
  4. public static void ShowMessageBox(string _message)
  5. {
  6. Page page = HttpContext.Current.Handler as Page;
  7. page.RegisterStartupScript("key2", "<script>alert('" + _message + "');</script>");
  8. }
  9.  
  10. // for async postback events
  11. public static void ShowMessageBoxForAsync(string _message)
  12. {
  13. Page page = HttpContext.Current.Handler as Page;
  14. ScriptManager.RegisterClientScriptBlock(page,page.GetType(), "key2", "alert('" + _message + "');", true);
  15. }
  16.  
  17. // Then you can call this in, let's say , button_click event handler like this ( i assume that your class name is Utilities without any namespace definition) :
  18. protected void myButton_Click(object sender, EventArgs e)
  19. {
  20. Utilities.ShowMessageBox("you entered a wrong password");
  21. }
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum


Views: 692 | Replies: 11
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC