473,607 Members | 2,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DataBoundContro l and implements
INamingContaine r, IPostBackEventH anlder and IPostBackDataHa ndler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHa ndler 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
LoadPostBackDat a or RaisePostBackEv ent 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 1350
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 DataBoundContro l and implements
INamingContaine r, IPostBackEventH anlder and IPostBackDataHa ndler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHa ndler 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
LoadPostBackDat a or RaisePostBackEv ent 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 ClientScriptMan ager method RegisterHiddenF ield(string
hiddenFieldName , string hiddenFieldInit ialValue) 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 DataBoundContro l and implements
INamingContaine r, IPostBackEventH anlder and IPostBackDataHa ndler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHa ndler 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
LoadPostBackDat a or RaisePostBackEv ent 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 ClientScriptMan ager method RegisterHiddenF ield(string
hiddenFieldName , string hiddenFieldInit ialValue) 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 DataBoundContro l and implements
INamingContaine r, IPostBackEventH anlder and IPostBackDataHa ndler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHa ndler 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
LoadPostBackDat a or RaisePostBackEv ent 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*****@nowher e.comwrote in message
news:02******** *************** ***********@mic rosoft.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*****@nowher e.comwrote in message
news:02******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co mwrote in message
news:9E******** *************** ***********@mic rosoft.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.Fi ndControl("MyMe nu");
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 ClientScriptMan ager method RegisterHiddenF ield(string
hiddenFieldNam e, string hiddenFieldInit ialValue) 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 DataBoundContro l and implements
INamingConta iner, IPostBackEventH anlder and IPostBackDataHa ndler. The control
is engineered to use a hidden client-side input textbox which stores a
selected index variable to enable the IPostBackDataHa ndler 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
LoadPostBack Data or RaisePostBackEv ent 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
290
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 concepts. Are master pages reliable or are they a buggy concept ? I understand master pages will be included in the next version of the framework ? Is there a reason not to use them presently ? Where can I obtain further documentation of the...
20
2411
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 include files to change the layout. When I came to ASP.NET, I used user controls to do a similar thing. I have just been looking at master pages, and it looks like they do the same thing. If so, is there any advantage in using them over the...
1
1859
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 master page looks like this... <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
17
3146
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 pages? Kinda sorta a critical point no? Am I missing something? Rob. P.S. the day I find a book that actually is useful rather than just a
2
3311
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 have set the background to display an image that is located in a directory called "images" which is just off the root directory. Here's the problem: Any page that is not located in the root directory (where the master page is located) cannot...
7
8698
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 remain the same. I am interested to know your opinions/suggestions in finding an easy way of doing it. In asp one could have something like this:
8
6682
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 and also my first true attempt at using master pages. I tried setting up a style sheet with a simple setting to float an image to the right and it had no effect on the image. Then, I tried putting the style code in my ASPX file as such,
3
5968
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 master page, which both of these child master pages are based on, and in turn the final pages are based on one of these child master pages.
6
1684
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 templates in that when the master page is updated, all the child pages created from the master page are updated and then they all need to be uploaded to the server? Or do you only have to upload the master page after an update?
0
8463
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8128
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8322
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5997
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4013
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2461
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.