473,388 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

THE MICROSOFT MASTER PAGES FUDGE

keywords: asp.net master page rubbish

I have written a custom control. The control is a simple html Tab menu
control. The control inherits from DataBoundControl and implements
INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHandler to determine a
change in tab and trigger a redraw of html. I am also controlling the
necessary viewstate to support the selected index and data set variables. My
control works fine and I am able to trap the server-side events for
OnTabClick and re-draw my control on DataChanged event. My problems arise
when my control is added to a Master page and in the event handler I redirect
to a Content page. Once I do this none of the control’s event seem to be
being fired, although the postback event handler must be being executed as
the content page is being merged!!! Crazy!!!. Neither the control’s
LoadPostBackData or RaisePostBackEvent methods are executing and I have tried
everything to figure out why this is the case and have now spent nearly two
weeks re-writing the custom control’s methods. Please, please, please,
Microsoft, help me figure this master page madness out as I am completely
stuck!!!

Mar 6 '07 #1
7 1342
Mark wrote:
keywords: asp.net master page rubbish

I have written a custom control. The control is a simple html Tab menu
control. The control inherits from DataBoundControl and implements
INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHandler to determine a
change in tab and trigger a redraw of html. I am also controlling the
necessary viewstate to support the selected index and data set variables. My
control works fine and I am able to trap the server-side events for
OnTabClick and re-draw my control on DataChanged event. My problems arise
when my control is added to a Master page and in the event handler I redirect
to a Content page. Once I do this none of the control’s event seem to be
being fired, although the postback event handler must be being executed as
the content page is being merged!!! Crazy!!!. Neither the control’s
LoadPostBackData or RaisePostBackEvent methods are executing and I have tried
everything to figure out why this is the case and have now spent nearly two
weeks re-writing the custom control’s methods. Please, please, please,
Microsoft, help me figure this master page madness out as I am completely
stuck!!!
Ouch. Please use line breaks to separate paragraphs.

One thing that changes when you put a control in a master page is the
names that is generated for the html elements. Do you hard code the
names of the elements in the client code?

--
Göran Andersson
_____
http://www.guffa.com
Mar 6 '07 #2
Goran,

What paragraphs? ;-)

Client-side code is working fine, I have checked using view source.

I am using the ClientScriptManager method RegisterHiddenField(string
hiddenFieldName, string hiddenFieldInitialValue) to output my hidden textbox.

As I have stated the control is working fine when I comment out the redirect
to content page in server-side event handler.
"Göran Andersson" wrote:
Mark wrote:
keywords: asp.net master page rubbish

I have written a custom control. The control is a simple html Tab menu
control. The control inherits from DataBoundControl and implements
INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHandler to determine a
change in tab and trigger a redraw of html. I am also controlling the
necessary viewstate to support the selected index and data set variables. My
control works fine and I am able to trap the server-side events for
OnTabClick and re-draw my control on DataChanged event. My problems arise
when my control is added to a Master page and in the event handler I redirect
to a Content page. Once I do this none of the control’s event seem to be
being fired, although the postback event handler must be being executed as
the content page is being merged!!! Crazy!!!. Neither the control’s
LoadPostBackData or RaisePostBackEvent methods are executing and I have tried
everything to figure out why this is the case and have now spent nearly two
weeks re-writing the custom control’s methods. Please, please, please,
Microsoft, help me figure this master page madness out as I am completely
stuck!!!

Ouch. Please use line breaks to separate paragraphs.

One thing that changes when you put a control in a master page is the
names that is generated for the html elements. Do you hard code the
names of the elements in the client code?

--
Göran Andersson
_____
http://www.guffa.com
Mar 6 '07 #3
ok, I think what's going on here is quite simply that the content page is
re-initializing the control.

I exposed the selected index as a property, referenced the control from the
content page and displayed the selected index, and hey-presto it was back to
-1!

Naturally the next question is, is there anyway stopping the
re-initialization of controls on the master page when redirecting to a
content page?

Where are all the mvps when you need them? Have they deserted the newsgroups?
"Mark" wrote:
Goran,

What paragraphs? ;-)

Client-side code is working fine, I have checked using view source.

I am using the ClientScriptManager method RegisterHiddenField(string
hiddenFieldName, string hiddenFieldInitialValue) to output my hidden textbox.

As I have stated the control is working fine when I comment out the redirect
to content page in server-side event handler.
"Göran Andersson" wrote:
Mark wrote:
keywords: asp.net master page rubbish
>
I have written a custom control. The control is a simple html Tab menu
control. The control inherits from DataBoundControl and implements
INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHandler to determine a
change in tab and trigger a redraw of html. I am also controlling the
necessary viewstate to support the selected index and data set variables. My
control works fine and I am able to trap the server-side events for
OnTabClick and re-draw my control on DataChanged event. My problems arise
when my control is added to a Master page and in the event handler I redirect
to a Content page. Once I do this none of the control’s event seem to be
being fired, although the postback event handler must be being executed as
the content page is being merged!!! Crazy!!!. Neither the control’s
LoadPostBackData or RaisePostBackEvent methods are executing and I have tried
everything to figure out why this is the case and have now spent nearly two
weeks re-writing the custom control’s methods. Please, please, please,
Microsoft, help me figure this master page madness out as I am completely
stuck!!!
>
Ouch. Please use line breaks to separate paragraphs.

One thing that changes when you put a control in a master page is the
names that is generated for the html elements. Do you hard code the
names of the elements in the client code?

--
Göran Andersson
_____
http://www.guffa.com
Mar 6 '07 #4
"Mark" <so*****@nowhere.comwrote in message
news:02**********************************@microsof t.com...
Naturally the next question is, is there anyway stopping the
re-initialization of controls on the master page when redirecting to a
content page?
A step back here...

This is a common misconception with MasterPages / content pages - they are
not the same as framesets... In fact, a MasterPage isn't actually a 'page'
at all - it's a UserControl...

When you redirect to a content page, the entire page is rebuilt from the
bottom up, and that includes opening the MasterPage and merging its contents
with the content page to form a single HTML stream to be sent down to the
browser...
Where are all the mvps when you need them? Have they deserted the
newsgroups?
Most probably they are all earning their own living... :-)
Mar 6 '07 #5
- Mark

The only misconception I think I have made with master pages is that I
thought they were designed to enable a clear page\content layout and
separation for web-sites. This is the only likening I had of master pages
with framesets. Which is obviously what they do ..... as long as the content
of the master page is STATIC!!

Perhaps my menu control should reside in another content page? How are
people providing menu driven web-sites with page\content separation?
"Mark Rae" wrote:
"Mark" <so*****@nowhere.comwrote in message
news:02**********************************@microsof t.com...
Naturally the next question is, is there anyway stopping the
re-initialization of controls on the master page when redirecting to a
content page?

A step back here...

This is a common misconception with MasterPages / content pages - they are
not the same as framesets... In fact, a MasterPage isn't actually a 'page'
at all - it's a UserControl...

When you redirect to a content page, the entire page is rebuilt from the
bottom up, and that includes opening the MasterPage and merging its contents
with the content page to form a single HTML stream to be sent down to the
browser...
Where are all the mvps when you need them? Have they deserted the
newsgroups?

Most probably they are all earning their own living... :-)
Mar 6 '07 #6
"Mark" <Ma**@discussions.microsoft.comwrote in message
news:9E**********************************@microsof t.com...
Perhaps my menu control should reside in another content page?
I'd suggest that your menu control should reside in your MasterPage - that's
certainly the way I do it...
How are people providing menu driven web-sites with page\content
separation?
If the menu needs to change according to the content page, it's a simple
enough thing to modify it in the content page's Page_Load event...

Menu mnuMaster = (Menu)Master.FindControl("MyMenu");
mnuMaster.Items.Add(.......................);

etc
Mar 6 '07 #7
There is no re-initialising going on, just initialising. When you do a
redirect you load a new page. There is no ViewState left from the
previous page as this is a completely new page.

If you want to persist any values, you have to either keep it on the
server, or send it along in the redirect.

Mark wrote:
ok, I think what's going on here is quite simply that the content page is
re-initializing the control.

I exposed the selected index as a property, referenced the control from the
content page and displayed the selected index, and hey-presto it was back to
-1!

Naturally the next question is, is there anyway stopping the
re-initialization of controls on the master page when redirecting to a
content page?

Where are all the mvps when you need them? Have they deserted the newsgroups?
"Mark" wrote:
>Goran,

What paragraphs? ;-)

Client-side code is working fine, I have checked using view source.

I am using the ClientScriptManager method RegisterHiddenField(string
hiddenFieldName, string hiddenFieldInitialValue) to output my hidden textbox.

As I have stated the control is working fine when I comment out the redirect
to content page in server-side event handler.
"Göran Andersson" wrote:
>>Mark wrote:
keywords: asp.net master page rubbish

I have written a custom control. The control is a simple html Tab menu
control. The control inherits from DataBoundControl and implements
INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHandler to determine a
change in tab and trigger a redraw of html. I am also controlling the
necessary viewstate to support the selected index and data set variables. My
control works fine and I am able to trap the server-side events for
OnTabClick and re-draw my control on DataChanged event. My problems arise
when my control is added to a Master page and in the event handler I redirect
to a Content page. Once I do this none of the control’s event seem to be
being fired, although the postback event handler must be being executed as
the content page is being merged!!! Crazy!!!. Neither the control’s
LoadPostBackData or RaisePostBackEvent methods are executing and I have tried
everything to figure out why this is the case and have now spent nearly two
weeks re-writing the custom control’s methods. Please, please, please,
Microsoft, help me figure this master page madness out as I am completely
stuck!!!

Ouch. Please use line breaks to separate paragraphs.

One thing that changes when you put a control in a master page is the
names that is generated for the html elements. Do you hard code the
names of the elements in the client code?

--
Göran Andersson
_____
http://www.guffa.com

--
Göran Andersson
_____
http://www.guffa.com
Mar 6 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Murphy | last post by:
I have read the articles by Paul Wilson regarding master pages, and apart from being totally confused I would like to clarify the following before investing any further time on researching these...
20
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...
1
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...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
2
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...
7
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...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
3
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...
6
by: Mickey | last post by:
Coming from a Dreamweaver/ASP/PHP background. Planning to use Visual Studio 2008 for a website. Complete newbie question here (please be gentle!): Do master pages work similar to Dreamweaver...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.