Hi Everyone,

New ASP.NET (C#) programmer here. Have a quick question that I'm sure you all will laugh at me for asking :)

I'm using a Master Page to control my site's pages. On the master page I have a User Control that consists of two Labels, one for success messages, one for error messages.

On each page, there are button to add/edit items. What I'm attempting to do is, using session variables, load a message into that User Control.

Now, this works just *fine* if I redirect to another page. For example. I add a new item, and on the newitem_onclick method, I load a success message into a session variable, then redirect to the item edit page. Bam, my message displays perfectly!!!

But....if I remain on the same page (such as when doing an update), the message does not display when I click the update button; I have to basically reload the page in order to see it.

I know it has something to do with the order in which the master page and other pages are loaded, but I'm stuck as to how to get around this. I know I can always do a Master.FindControl, but I don't want to do that at the top of all my pages (hence the reason I'm using a control).

Any ideas? My goal is to not have to add additional code to individual pages in order to get this to display messages all the time.

Thanks
Dave

Found it!

Had to put it in the Master Page's PreRender event!

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.