Click here to Skip to main content
15,887,596 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to integrate pay pal code in asp.net using c#.net Pin
Abhishek Sur29-Dec-09 21:27
professionalAbhishek Sur29-Dec-09 21:27 
Questionhow to use globalization using resorce files Pin
developerit29-Dec-09 21:11
developerit29-Dec-09 21:11 
AnswerRe: how to use globalization using resorce files Pin
Abhishek Sur29-Dec-09 21:26
professionalAbhishek Sur29-Dec-09 21:26 
Questiondisplaying an alert in codebehind while using updatepanel control Pin
sanjubaba29-Dec-09 19:46
sanjubaba29-Dec-09 19:46 
AnswerRe: displaying an alert in codebehind while using updatepanel control Pin
m@dhu29-Dec-09 20:06
m@dhu29-Dec-09 20:06 
AnswerRe: displaying an alert in codebehind while using updatepanel control Pin
Pranay Rana29-Dec-09 20:38
professionalPranay Rana29-Dec-09 20:38 
AnswerRe: displaying an alert in codebehind while using updatepanel control Pin
Abhishek Sur29-Dec-09 21:30
professionalAbhishek Sur29-Dec-09 21:30 
GeneralRe: displaying an alert in codebehind while using updatepanel control [modified] Pin
sanjubaba29-Dec-09 23:41
sanjubaba29-Dec-09 23:41 
hi,
   indeed this was a very good solution.

now i making this thing generic. so that i only have to call the msgpopup class and display the message. i am calling the dll of the project where i am writing the same code

ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('hi');", true);

but this seems to be not working. it fails to display the message box.

following is the code in the dll.

the code:--
==========

using System;
      using System.Data;
      using System.Configuration;
      using System.Web;     
      using System.Collections;
      using System.Text;
      using System.Web.UI;

      /// <summary>
      /// Summary description for MsgPopUp
      /// </summary>
public class MsgPopUp
{

      protected static Hashtable handlerPages = new Hashtable();     

      public static void Show(string Message)
      {           
            try
            {
                  if (!(handlerPages.Contains(HttpContext.Current.Handler)))
                  {

                        Page currentPage = (Page)HttpContext.Current.Handler;

                        if (!((currentPage == null)))
                        {
                              Queue messageQueue = new Queue();
                              messageQueue.Enqueue(Message);

                              handlerPages.Add(HttpContext.Current.Handler, messageQueue);
                              currentPage.Unload += new EventHandler(CurrentPageUnload);
                        }
                  }
                  else
                  {
                        Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));
                        queue.Enqueue(Message);
                  }
            }
            catch (Exception ex)
            {
                  throw ex;
            }
      }

      private static void CurrentPageUnload(object sender, EventArgs e)
      {
            try
            {
                  Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));

                  if (queue != null)
                  {

                        StringBuilder builder = new StringBuilder();

                        int iMsgCount = queue.Count;

                        builder.Append("<script language='javascript'>");

                        string sMsg;

                        while ((iMsgCount > 0))
                        {

                              iMsgCount = iMsgCount - 1;

                              sMsg = System.Convert.ToString(queue.Dequeue());

                              sMsg = sMsg.Replace("\"", "'");

                              builder.Append("alert( \"" + sMsg + "\" );");

                        }

                        builder.Append("</script>");

                        handlerPages.Remove(HttpContext.Current.Handler);

                        //HttpContext.Current.Response.Write(builder.ToString());
                       
                        Page currentPage = (Page)HttpContext.Current.Handler;                       
                       
                        ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), Guid.NewGuid().ToString(), "alert('from baseengine')", true);
                        //if (!script.IsClientScriptBlockRegistered(script.GetType(), "Alert"))
                        //{
                        //      script.RegisterClientScriptBlock(script.GetType(), "Alert", "alert('record inserted');", false);
                        //}
                  }
            }
            catch (Exception ex)
            {
                  throw ex;
            }
      }

}

}

Sandeep Kumbhar

modified on Wednesday, December 30, 2009 7:12 AM

QuestionASP.NET SOAP Server/Client with Complex Types Pin
captainone29-Dec-09 9:13
captainone29-Dec-09 9:13 
AnswerRe: ASP.NET SOAP Server/Client with Complex Types Pin
sri_346429-Dec-09 16:22
sri_346429-Dec-09 16:22 
QuestionCustomize web deployment setup Pin
sri_346429-Dec-09 8:14
sri_346429-Dec-09 8:14 
AnswerRe: Customize web deployment setup Pin
Abhijit Jana29-Dec-09 16:33
professionalAbhijit Jana29-Dec-09 16:33 
GeneralRe: Customize web deployment setup Pin
sri_346429-Dec-09 16:55
sri_346429-Dec-09 16:55 
QuestionBest way to deploy a site to several servers at once Pin
DeepToot29-Dec-09 7:29
DeepToot29-Dec-09 7:29 
AnswerRe: Best way to deploy a site to several servers at once Pin
sri_346429-Dec-09 8:17
sri_346429-Dec-09 8:17 
GeneralRe: Best way to deploy a site to several servers at once Pin
DeepToot29-Dec-09 9:03
DeepToot29-Dec-09 9:03 
Questionchecking if email exists in facebook, twitter, linkedin, myspace... Pin
laziale29-Dec-09 6:34
laziale29-Dec-09 6:34 
QuestionVirtual Classroom project in ASP.Net Pin
sumit4729-Dec-09 6:22
sumit4729-Dec-09 6:22 
AnswerRe: Virtual Classroom project in ASP.Net Pin
yesu prakash29-Dec-09 16:56
yesu prakash29-Dec-09 16:56 
AnswerRe: Virtual Classroom project in ASP.Net Pin
mukeshyadav3728-Aug-10 8:04
mukeshyadav3728-Aug-10 8:04 
GeneralRe: Virtual Classroom project in ASP.Net Pin
sardar.nale20-Mar-11 21:18
sardar.nale20-Mar-11 21:18 
GeneralRe: Virtual Classroom project in ASP.Net Pin
sathishkumar.skn12-Aug-13 20:18
sathishkumar.skn12-Aug-13 20:18 
QuestionGridView dropdownlist issue Pin
Priya Prk29-Dec-09 5:37
Priya Prk29-Dec-09 5:37 
AnswerRe: GridView dropdownlist issue Pin
Abhijit Jana29-Dec-09 6:02
professionalAbhijit Jana29-Dec-09 6:02 
AnswerRe: GridView dropdownlist issue Pin
PunkIsNotDead29-Dec-09 6:43
PunkIsNotDead29-Dec-09 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.