Hi there,
I've created a master page with some controls on it, a Calendar control
among others. Now depending on the date(s) selected, the content page needs
to be updated. In the masterpage I've created StartDate and EndDate
properties, which are basically wrappers around the SelectedDates property
from the Calendar control.
When I select another date in the Calendar, the page updates normally, but
when Page_Load for the content page fires, the selected dates aren't updated
yet. The problem is probably that the content page gets updated first, and
then the master page.
How do I work around this problem? Or is this more like a bug in the
framework? Matbe what should happen, is that both the master page *and* the
content page should be updated, and *then* the Page_Load event(s) should be
called.
Anyone has any input on this?
--
Thanks,
Martijn Saly 7 1903
The SelectedDate property of the Calendar will not be updated until
the calendar's SelectionChanged event fires (which will be after
Page_Load for both the content page and the master).
Yes, I think the Calendar is a bit quirky in this respect. Any other
control that has an 'auto-postback' will be updated by Page_Load.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Sat, 10 Sep 2005 12:08:36 +0200, Martijn Saly <ma*****@thany.org>
wrote: Hi there,
I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control.
When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page fires, the selected dates aren't updated yet. The problem is probably that the content page gets updated first, and then the master page.
How do I work around this problem? Or is this more like a bug in the framework? Matbe what should happen, is that both the master page *and* the content page should be updated, and *then* the Page_Load event(s) should be called.
Anyone has any input on this?
Scott, your closing statement is not neccessarily correct when controls are
used in MasterPages.
A LinkButton that is a child of a Panel located in a MasterPage will not and
need not raise a PostBack event when the LinkButton click event is raised.
Furthermore, the controls disappear from the ViewState reverting to their
state before any click events were raised (why in my circumstances is now
undestood but how to respond has brought me to a stand still).
I begin to discuss the topic at the ASP.NET Forums [1] and have been trying
to get the attention of somebody like yourself who has done the early work
with 2.0 to help debug and make sense of how to respond to controls that
simply disappear from ViewState. Will you take it on with me here on in the
forums?
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
[1] http://forums.asp.net/1039817/ShowPost.aspx
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:vb********************************@4ax.com... The SelectedDate property of the Calendar will not be updated until the calendar's SelectionChanged event fires (which will be after Page_Load for both the content page and the master).
Yes, I think the Calendar is a bit quirky in this respect. Any other control that has an 'auto-postback' will be updated by Page_Load.
-- Scott http://www.OdeToCode.com/blogs/scott/ On Sat, 10 Sep 2005 12:08:36 +0200, Martijn Saly <ma*****@thany.org> wrote:
Hi there,
I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control.
When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page fires, the selected dates aren't updated yet. The problem is probably that the content page gets updated first, and then the master page.
How do I work around this problem? Or is this more like a bug in the framework? Matbe what should happen, is that both the master page *and* the content page should be updated, and *then* the Page_Load event(s) should be called.
Anyone has any input on this?
Scott Allen wrote: The SelectedDate property of the Calendar will not be updated until the calendar's SelectionChanged event fires (which will be after Page_Load for both the content page and the master).
Not true, when selecting a date, I can clearly see while debugging the
Page_load event of the master page, that SelectedDates is updated as expected.
Yes, I think the Calendar is a bit quirky in this respect. Any other control that has an 'auto-postback' will be updated by Page_Load.
The problem is that the master page should be updated before the content
page. Now it's the other way around, and therefor a content page cannot know
about any changes in any control on its master page.
--
Thanks,
Martijn Saly
On Sat, 10 Sep 2005 18:52:52 +0200, Martijn Saly <ma*****@thany.org>
wrote: Scott Allen wrote: The SelectedDate property of the Calendar will not be updated until the calendar's SelectionChanged event fires (which will be after Page_Load for both the content page and the master).
Not true, when selecting a date, I can clearly see while debugging the Page_load event of the master page, that SelectedDates is updated as expected.
Are we talking about a date selected by the user who clicked on a new
day / week in the Calendar control? This calendar will not know the
date until the logic in RaisePostBackEvent executes, which is after
Page_Load. The code for a form at the bottom of this post will
demonstrate this fact by checking the SelectedDate property during
Page_Load, and during Page_PreRender (which is after
RaisePostBackEvent). The 2 labels on the form will show different
dates when you start clicking on links. Yes, I think the Calendar is a bit quirky in this respect. Any other control that has an 'auto-postback' will be updated by Page_Load.
The problem is that the master page should be updated before the content page. Now it's the other way around, and therefor a content page cannot know about any changes in any control on its master page.
Ah - I think I understand the problem now. When you say "selecting a
date" you mean programatically, not by clicking on the Calendar at
runtime, right?
The way master pages are implemented they become a child control in
the content page's Controls collection, thus Page_Load for the content
page will always fire before Page_Load in the master page: http://odetocode.com/Blogs/scott/arc...9/10/2179.aspx
It's handy to think of the master page as just another user control on
the page when it comes time to executing logic in response to events.
Code:
<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(object o, EventArgs e)
{
LoadLabel.Text = Calendar1.SelectedDate.ToString();
}
void Page_PreRender(object o, EventArgs e)
{
PreRenderLabel.Text = Calendar1.SelectedDate.ToString();
}
</script>
<html>
<head runat="server">
<title>Calendar</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar runat="server" ID="Calendar1"/>
<br />
<asp:Label runat="server" ID="LoadLabel"/>
<br />
<asp:Label runat="server" ID="PreRenderLabel" />
</div>
</form>
</body>
</html>
--
Scott http://www.OdeToCode.com/blogs/scott/
Can you give me some code to try myself? I'll definitely take a look.
Feel free to email me, too.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Sat, 10 Sep 2005 11:12:31 -0500, "clintonG"
<cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote: Scott, your closing statement is not neccessarily correct when controls are used in MasterPages.
A LinkButton that is a child of a Panel located in a MasterPage will not and need not raise a PostBack event when the LinkButton click event is raised. Furthermore, the controls disappear from the ViewState reverting to their state before any click events were raised (why in my circumstances is now undestood but how to respond has brought me to a stand still).
I begin to discuss the topic at the ASP.NET Forums [1] and have been trying to get the attention of somebody like yourself who has done the early work with 2.0 to help debug and make sense of how to respond to controls that simply disappear from ViewState. Will you take it on with me here on in the forums?
<%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT metromilwaukee.com URL http://metromilwaukee.com/ URL http://clintongallagher.metromilwaukee.com/
[1] http://forums.asp.net/1039817/ShowPost.aspx
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message news:vb********************************@4ax.com.. . The SelectedDate property of the Calendar will not be updated until the calendar's SelectionChanged event fires (which will be after Page_Load for both the content page and the master).
Yes, I think the Calendar is a bit quirky in this respect. Any other control that has an 'auto-postback' will be updated by Page_Load.
-- Scott http://www.OdeToCode.com/blogs/scott/ On Sat, 10 Sep 2005 12:08:36 +0200, Martijn Saly <ma*****@thany.org> wrote:
Hi there,
I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control.
When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page fires, the selected dates aren't updated yet. The problem is probably that the content page gets updated first, and then the master page.
How do I work around this problem? Or is this more like a bug in the framework? Matbe what should happen, is that both the master page *and* the content page should be updated, and *then* the Page_Load event(s) should be called.
Anyone has any input on this?
As it turns out I've been trying to build my own tabbed navigation and am
now going to try to do so using a Menu control that will load SiteMapPath
controls instead of LinkButtons and Panel controls but I do want to follow
through on the issue I raised as there is an important issue related to
referencing controls that I have not mastered (pun intended) when using
MasterPages.
The former method I've been asking questions about used LinkButtons to
change visibility for a Panel control which contained other LinkButtons used
to load content pages in the master. When I attempted to use the LinkButton
which is the child of the Panel the content page would load but the Panel
and its child controls would disappear.
Somebody finally pointed out the reason the control state was being lost was
because I was actually navigating and not using a PostBack and actually just
reloading the MasterPage in the same state it was before the LinkButton
event was used to load a content page. I understand that but still need to
master how to access a child control such as a LinkButton when it is a child
of the Panel which is in the MasterPage.
Your otherwise outstanding article "In Search of ASP.NET Controls" [1] was
helpful and a frequent reference but did not hit the sweet spot for me in
this unique circumstance when using MasterPages primarily I believe because
your focus while writing the article was the use of the FindControl method
which is rather easy to use when controls are in the page but not when a
control is a child of a control in the page when using MasterPages.
I even tried using the new Cross-Page Posting, PostBackUrl and PreviousPage
property which will pass the control state to the new page but I could not
reference that LinkButton child of the Panel.
Mood: braindead ;-)
<%= Clinton Gallagher
[1] http://www.odetocode.com/Articles/116.aspx
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:jj********************************@4ax.com... Can you give me some code to try myself? I'll definitely take a look. Feel free to email me, too.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Sat, 10 Sep 2005 11:12:31 -0500, "clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote:
Scott, your closing statement is not neccessarily correct when controls are used in MasterPages.
A LinkButton that is a child of a Panel located in a MasterPage will not and need not raise a PostBack event when the LinkButton click event is raised. Furthermore, the controls disappear from the ViewState reverting to their state before any click events were raised (why in my circumstances is now undestood but how to respond has brought me to a stand still).
I begin to discuss the topic at the ASP.NET Forums [1] and have been trying to get the attention of somebody like yourself who has done the early work with 2.0 to help debug and make sense of how to respond to controls that simply disappear from ViewState. Will you take it on with me here on in the forums?
<%= Clinton Gallagher METROmilwaukee (sm) "A Regional Information Service" NET csgallagher AT metromilwaukee.com URL http://metromilwaukee.com/ URL http://clintongallagher.metromilwaukee.com/
[1] http://forums.asp.net/1039817/ShowPost.aspx
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message news:vb********************************@4ax.com. .. The SelectedDate property of the Calendar will not be updated until the calendar's SelectionChanged event fires (which will be after Page_Load for both the content page and the master).
Yes, I think the Calendar is a bit quirky in this respect. Any other control that has an 'auto-postback' will be updated by Page_Load.
-- Scott http://www.OdeToCode.com/blogs/scott/ On Sat, 10 Sep 2005 12:08:36 +0200, Martijn Saly <ma*****@thany.org> wrote:
Hi there,
I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control.
When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page fires, the selected dates aren't updated yet. The problem is probably that the content page gets updated first, and then the master page.
How do I work around this problem? Or is this more like a bug in the framework? Matbe what should happen, is that both the master page *and* the content page should be updated, and *then* the Page_Load event(s) should be called.
Anyone has any input on this? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Herman \(Parallelspace\) |
last post by:
1. What are some compelling solutions for using Master/Content pages with
Web Pages?
2. If a content area has a web part zone with web parts, what is the user
experience like when "editting" the...
|
by: Alan Silver |
last post by:
Hello,
In classic ASP, I used to use two include files on each page, one before
and one after the main content, to provide a consistent layout across a
web site. That way I could just change the...
|
by: Alan Silver |
last post by:
Hello,
I am just experimenting with master pages, and am trying to add a
content placeholder in the <head> section, so that individual pages can
set their own page title and meta tags. The...
|
by: EagleRed |
last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page.
Currently, there are two pages, Freedom1.master and Freedom2.master. I have
no problems with Freedom1.master. However,...
|
by: otto |
last post by:
Hi, all:
I have a problem with the inclusion of .js files in mu .aspx pages when
using Master Pages. I try to explain it. If I make a web project without
master pages I simply put in the head...
|
by: news.sbcglobal.net |
last post by:
I hope I can explain this well enough to understand. I have a master page
that is used by almost all of the pages in my site. On the master page is a
table. In one of the cells in this table, I...
|
by: xkeops |
last post by:
Thinking of creating a website, most of the pages will have a general
toolbar
menu, a content and a footer.
The content will be the only one who's gonna change but the rest
(header,footer)
will...
|
by: Argirop |
last post by:
I have a page Default.aspx. Its first line is the following:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="default.aspx.cs"...
|
by: Rich |
last post by:
Hi,
I want to use 2 master pages, one for the main part of the site, the other
for the admin pages.
They are quite similar, with many shared elements.
Ideally I would like to have a parent...
|
by: =?Utf-8?B?SmF5IFBvbmR5?= |
last post by:
I am trying to access a Public property on a Master Page from a Base Page.
On the content pages I have the MasterType Directive set up as follows:
<%@ MasterType virtualpath="~/Master.master" %>...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
| |