Click here to Skip to main content
15,889,527 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: ASP.NET Gridview DataBound event retaining previous value Pin
Arun Jacob26-Aug-09 23:02
Arun Jacob26-Aug-09 23:02 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value Pin
Inderjeet Kaur26-Aug-09 23:25
Inderjeet Kaur26-Aug-09 23:25 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value Pin
Ibrahim Bello27-Aug-09 2:00
Ibrahim Bello27-Aug-09 2:00 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value [modified] Pin
Inderjeet Kaur27-Aug-09 16:53
Inderjeet Kaur27-Aug-09 16:53 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value Pin
Ibrahim Bello27-Aug-09 21:00
Ibrahim Bello27-Aug-09 21:00 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value Pin
Inderjeet Kaur27-Aug-09 21:29
Inderjeet Kaur27-Aug-09 21:29 
GeneralRe: ASP.NET Gridview DataBound event retaining previous value Pin
Ibrahim Bello27-Aug-09 23:07
Ibrahim Bello27-Aug-09 23:07 
Questionmessagebox Pin
ankitjain111026-Aug-09 21:50
ankitjain111026-Aug-09 21:50 
public class MessageBox
{
private static Hashtable m_executingPages = new Hashtable();

private MessageBox(){}

public static void Show( string sMessage )
{
// If this is the first time a page has called this method then

if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
{
// Attempt to cast HttpHandler as a Page.

Page executingPage = HttpContext.Current.Handler as Page;

if( executingPage != null )
{
// Create a Queue to hold one or more messages.

Queue messageQueue = new Queue();

// Add our message to the Queue

messageQueue.Enqueue( sMessage );

// Add our message queue to the hash table. Use our page reference

// (IHttpHandler) as the key.

m_executingPages.Add( HttpContext.Current.Handler, messageQueue );

// Wire up Unload event so that we can inject

// some JavaScript for the alerts.

executingPage.Unload += new EventHandler( ExecutingPage_Unload );
}
}
else
{
// If were here then the method has allready been

// called from the executing Page.

// We have allready created a message queue and stored a

// reference to it in our hastable.

Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];

// Add our message to the Queue

queue.Enqueue( sMessage );
}
}


// Our page has finished rendering so lets output the

// JavaScript to produce the alert's

private static void ExecutingPage_Unload(object sender, EventArgs e)
{
// Get our message queue from the hashtable

Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];

if( queue != null )
{
StringBuilder sb = new StringBuilder();

// How many messages have been registered?

int iMsgCount = queue.Count;

// Use StringBuilder to build up our client slide JavaScript.

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

// Loop round registered messages

string sMsg;
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
sb.Append( @"alert( """ + sMsg + @""" );" );
}

// Close our JS

sb.Append( @"</script>" );

// Were done, so remove our page reference from the hashtable

m_executingPages.Remove( HttpContext.Current.Handler );

// Write the JavaScript to the end of the response stream.

HttpContext.Current.Response.Write( sb.ToString() );
}
}
}
i tried dis code but its showing some error.
Error 1 Too many characters in character literal C:\Users\Ankit\Documents\Visual Studio 2005\WebSites\WebSite1\Default2.aspx.cs 93 37 C:\...\WebSite1\
the literal is javascript
AnswerRe: messagebox Pin
ankitjain111026-Aug-09 21:59
ankitjain111026-Aug-09 21:59 
GeneralRe: messagebox Pin
Coding C#26-Aug-09 22:22
Coding C#26-Aug-09 22:22 
GeneralRe: messagebox Pin
ankitjain111026-Aug-09 22:34
ankitjain111026-Aug-09 22:34 
GeneralRe: messagebox Pin
Coding C#26-Aug-09 22:39
Coding C#26-Aug-09 22:39 
GeneralRe: messagebox Pin
ankitjain111026-Aug-09 22:57
ankitjain111026-Aug-09 22:57 
GeneralRe: messagebox Pin
ankitjain111026-Aug-09 23:15
ankitjain111026-Aug-09 23:15 
QuestionHow to set CustomValidor for FileUpload Pin
shaik_mr26-Aug-09 21:27
shaik_mr26-Aug-09 21:27 
AnswerRe: How to set CustomValidor for FileUpload Pin
Ibrahim Bello27-Aug-09 1:20
Ibrahim Bello27-Aug-09 1:20 
QuestionAdding values to data gridview programmatically Pin
myinstincts26-Aug-09 21:26
myinstincts26-Aug-09 21:26 
Questionwhile using blank file , fileUpload doesn't work. Pin
Priyagdpl26-Aug-09 21:14
Priyagdpl26-Aug-09 21:14 
AnswerRe: while using blank file , fileUpload doesn't work. Pin
Arun Jacob26-Aug-09 21:33
Arun Jacob26-Aug-09 21:33 
GeneralRe: while using blank file , fileUpload doesn't work. Pin
Priyagdpl26-Aug-09 21:44
Priyagdpl26-Aug-09 21:44 
Questionthere is no source code available for the current location Pin
haleemasher26-Aug-09 21:13
haleemasher26-Aug-09 21:13 
AnswerRe: there is no source code available for the current location Pin
Arun Jacob26-Aug-09 21:22
Arun Jacob26-Aug-09 21:22 
AnswerRe: there is no source code available for the current location Pin
haleemasher26-Aug-09 21:27
haleemasher26-Aug-09 21:27 
Questionscripts in adrotator control? Pin
Member 387988126-Aug-09 21:06
Member 387988126-Aug-09 21:06 
AnswerRe: scripts in adrotator control? Pin
Arun Jacob26-Aug-09 21:10
Arun Jacob26-Aug-09 21:10 

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.