943,742 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1764
  • ASP.NET RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 14th, 2009
-1

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

hello dnanetwork , how r u ? Have u blocked,dat nobody can send u privat message?
Reputation Points: 0
Solved Threads: 8
Posting Whiz
sonia sardana is offline Offline
326 posts
since Mar 2008
Sep 14th, 2009
0

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

ASP.NET Syntax (Toggle Plain Text)
  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. }
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Dropdownlist_SelectedIndexChanged
Next Thread in ASP.NET Forum Timeline: what is the code to perform signout in C#





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC