Web Forms :: Master Page Load Event Firing Multiple Times
Jan 27, 2010
am using a master page, with children pages.
I am using forms authentication, and a session object to hold user information once the user is authenticated.
I am able to login and log out. I am able to log in and use the "remember me" functionality of the forms authentication.
When attempting to test the "remember me" functionality, the master page load event contains code to check the forms authentication & remember me, and retrieve user info from the database to automatically log the user in. This fires correctly, and the screens all load with the user successfuly logged in, and the users info is successfully stored in a session object.
Without touching anything on the screen, a moment passes and then the master page load event spontaneously fires again, Page.User.Identity.Name still contains the user name, however the session variable is now null, and throws an error.If I tell it to run past this error, it does, and the application continues to function normally, withthe session variables set correctly.
Its almost as if that second firing is ina different session, or something.
I have no problem posting code, but I have a profile class holding / handling the session communication, etc so it is a bit cumbersome.
now a days i'm working on my project. In project there is a aspx page which is binded with a masterpage, the problem is that when i run the project in debugging mode i found that page load event of a page is firing two times instead of one along with masterpage page's page load event. This is crreating a problem in filling a grid. I searched through the internet for this problem some says that it may happen if u have any image whose src="" or due to some bad HTML's on page .But i've gone through the page it does not contain any image whose src="" .
I have a master page with a login box on it. Inside the login box is a button -
NOW ... On my local dev machine this code works fine. The control fires the event and everything is how it should be. When I run this site on a remote web server (tried two of them - both IIS7 running on 2008 R2) the event is never called. I added some logging to see what is happening and the PostBack event on the Master Page does not happen when the button is clicked - the page is just reloaded.
I have a page with in a master page. This page has a user control with a text box and a button. I also have another button on the page. As the page first loads the button_click event on both the controls does not fire when clicking the buttons. I also have an event on the enter key on the text box. This event fires which causes a post back. After post back now my button_click event fire. The button_click event does not fire on the first page_load.
I have a fairly complex web app which has two levels of master page. The top level provides a nav bar constructed from a Menu control across the top of the page. Second level master pages provide menus down the side. It all works well.
On both Menu controls, I need to handle the MenuItemClick event. This works fine on the Menu controls on the second-level master pages. However, the Menu on the top level master does not raise the event at all.
This web site makes extensive use of Ajax and the top-level master page contains the ScriptManager. Before I go to all the work of creating a much simpler test site, why the Menu control is not raising the MenuItemClick event?
Here is the markup for the Menu in the top-level master:
Here is the MenuItemClick event handler:
The logging call in the event handler never gets called. Equivalent code in the Menu on the second-level master does get called.
I have developed an application using Visual Studio 2008. I have a hirerchical gridview and on every row i have a "Payment" button which actually inserts a payment entry in database. Here is the sample screen of that gridview so u have an idea what i am doing. Problem is that whenever user pressed the button of "PAYMENT" it is inserting multiple records in database..it should only fire once and i am failed to understand why its firing multiple times. Refer this link for my payment screen: [URL]
I have a simple UserControl that I've created that simply allows a user to enter the date. For the time being, it has a single Textbox with ID="tbDate". I am trying to dynamically add this control multiple times via (for example) `placeholder.Controls.Add(LoadControl())` but am receiving the error "An entry with the same key already exists". I could, perhaps, change the ID of the elements but then it would be difficult to grab the value entered by the user.
In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple times , even when i have not restarted the application.
Its being repetadly called when i am calling different actions , so the webconfig is repetedly updating & making my application very very slow. what's the reason & how to handle this .
I have a data grid in which I have to display around 12,000 records. Even if I do paging it is difficult to display all the records. Is there any other control or something else so that I can display all these records. Even if I make these as alphabetical also, some times I have to load 1000 records in a page which is difficult.
I'm sure this is an easy one, but when I'm not using a code behind, I can get the Literal to change to my default text, but when I am using the code behind to insert my code, it's acting as if the Page Load event doesn't fire off, and the default text ofText to display2 is still shown, when it should show test. Can anyone show me what I've done wrong?