473,735 Members | 11,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 Questions about using AJAX with Master Page

Hi,

Trying to create a master page that holds a menu, and the menu switches
between pages in the site. 2 problem arrosed:

a. When I navigate from page to page (all AJAX Web Forms, with the Master
pages as their master...) the entire page is refreshed - also the menu which
belongs to the master, how can I fix it - so only the inside content will be
refreshed ?

b. When I try to put an AJAX enabled control that I've created inside one of
the page, I get an error - either I don't have a Script manager (which is
located on the master page btw) or - if I add a script manager - that I have
1 too many...
so - I damned if I do and damned if I don't...

how can I create a control that only updates itself (it's a bunch of
comboboxes depends on each other) and put it in that kind of web page ?

Thanks,

Dani

Jun 27 '08 #1
10 2140
"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:93******** *************** ***********@mic rosoft.com...
Trying to create a master page that holds a menu, and the menu switches
between pages in the site. 2 problem arrose:

a. When I navigate from page to page (all AJAX Web Forms, with the Master
pages as their master...) the entire page is refreshed - also the menu
which
belongs to the master, how can I fix it - so only the inside content will
be
refreshed ?
I'm afraid you've made the "classic" newbie misconception about MasterPages
that they are somehow the ASP.NET equivalent of framesets. They are nothing
at all like framesets. In fact, a MasterPage is nothing more than a special
kind of UserControl. When a content page is requested, it loads its
MasterPage control which it merges with its own markup and creates a single
page. This happens every time. That's how MasterPages work...
b. When I try to put an AJAX enabled control that I've created inside one
of
the page, I get an error - either I don't have a Script manager (which is
located on the master page btw) or - if I add a script manager - that I
have
1 too many...
so - I damned if I do and damned if I don't...
http://aspalliance.com/1285_Tip_and_...Master_Pages.5
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2
Thanks for the quick reply.
Is there a "Good" way to write a site that uses a master page and doesn't
make the menu reload every time ?
Dani
"Mark Rae [MVP]" wrote:
"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:93******** *************** ***********@mic rosoft.com...
Trying to create a master page that holds a menu, and the menu switches
between pages in the site. 2 problem arrose:

a. When I navigate from page to page (all AJAX Web Forms, with the Master
pages as their master...) the entire page is refreshed - also the menu
which
belongs to the master, how can I fix it - so only the inside content will
be
refreshed ?

I'm afraid you've made the "classic" newbie misconception about MasterPages
that they are somehow the ASP.NET equivalent of framesets. They are nothing
at all like framesets. In fact, a MasterPage is nothing more than a special
kind of UserControl. When a content page is requested, it loads its
MasterPage control which it merges with its own markup and creates a single
page. This happens every time. That's how MasterPages work...
b. When I try to put an AJAX enabled control that I've created inside one
of
the page, I get an error - either I don't have a Script manager (which is
located on the master page btw) or - if I add a script manager - that I
have
1 too many...
so - I damned if I do and damned if I don't...

http://aspalliance.com/1285_Tip_and_...Master_Pages.5
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #3
"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:69******** *************** ***********@mic rosoft.com...

[top-posting corrected]
>>a. When I navigate from page to page (all AJAX Web Forms, with the
Master
pages as their master...) the entire page is refreshed - also the menu
which belongs to the master, how can I fix it - so only the inside
content will
be refreshed ?

I'm afraid you've made the "classic" newbie misconception about
MasterPages
that they are somehow the ASP.NET equivalent of framesets. They are
nothing
at all like framesets. In fact, a MasterPage is nothing more than a
special
kind of UserControl. When a content page is requested, it loads its
MasterPage control which it merges with its own markup and creates a
single
page. This happens every time. That's how MasterPages work...

Is there a "Good" way to write a site that uses a master page and doesn't
make the menu reload every time ?
I've obviously not explained clearly enough - when I said "That's how
MasterPages work", that's what I meant...

Specifically, a MasterPage is just a UserControl like any other UserControl.
When you add a UserControl to a page, it gets loaded every time the page
loads. That's how UserControls work. A MasterPage is a UserControl, so it
gets loaded every time the page loads. That's how MasterPages work, because
MasterPages are UserControls...

MasterPages are't frames. That's not how MasterPages work...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #4
I haven't tried myself but wonder if the update panel can be loaded in the
content page. I presume that would produce desired results. Furthermore,
when the Menu control is in the Master there will likely be some additional
coding required.

Technically speaking, it should also be noted Mark is incorrect because the
MasterPage is --not-- a User Control per se but a unique type which
functions similar to a User Control and then only when the page is compiled.

Most people do not want to explain in detail. Since the typed Master
functions similar to a User Control it has become common to describe it as
such to help people understand that Master Pages do not function like HTML
Framesets.

I would go to http://odetocode.com/ as K. Scott Allen has done a lot of work
describing MasterPages but that was before AJAX so I don't know if he's done
anything in the context of using AJAX. Going to the forums at
http://asp.net/ would be helpful too.

"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:er******** ******@TK2MSFTN GP05.phx.gbl...
"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:69******** *************** ***********@mic rosoft.com...

[top-posting corrected]
>>>a. When I navigate from page to page (all AJAX Web Forms, with the
Master
pages as their master...) the entire page is refreshed - also the menu
which belongs to the master, how can I fix it - so only the inside
content will
be refreshed ?

I'm afraid you've made the "classic" newbie misconception about
MasterPages
that they are somehow the ASP.NET equivalent of framesets. They are
nothing
at all like framesets. In fact, a MasterPage is nothing more than a
special
kind of UserControl. When a content page is requested, it loads its
MasterPage control which it merges with its own markup and creates a
single
page. This happens every time. That's how MasterPages work...

Is there a "Good" way to write a site that uses a master page and doesn't
make the menu reload every time ?

I've obviously not explained clearly enough - when I said "That's how
MasterPages work", that's what I meant...

Specifically, a MasterPage is just a UserControl like any other
UserControl. When you add a UserControl to a page, it gets loaded every
time the page loads. That's how UserControls work. A MasterPage is a
UserControl, so it gets loaded every time the page loads. That's how
MasterPages work, because MasterPages are UserControls...

MasterPages are't frames. That's not how MasterPages work...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Jun 27 '08 #5
"clintonG" <no****@nowhere .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Technically speaking, it should also be noted Mark is incorrect because
the MasterPage is --not-- a User Control per se but a unique type which
functions similar to a User Control and then only when the page is
compiled.
A MasterPage absolutely is a UserControl.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #6
So you should have no problem at all providing a URL from MSDN2 that
definitively and without question documents the typed Master as a User
Control.

<%= Clinton Gallagher
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
"clintonG" <no****@nowhere .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Technically speaking, it should also be noted Mark is incorrect because
the MasterPage is --not-- a User Control per se but a unique type which
functions similar to a User Control and then only when the page is
compiled.

A MasterPage absolutely is a UserControl.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Jun 27 '08 #7
re:
!So you should have no problem at all providing a URL from MSDN2 that
!definitively and without question documents the typed Master as a User Control.

clintonG :

Here's 3 URLs which list MasterPage Properties, Members and Methods :

http://msdn.microsoft.com/en-us/libr...roperties.aspx
http://msdn.microsoft.com/en-us/libr...e_members.aspx
http://msdn.microsoft.com/en-us/libr...e_methods.aspx

Notice that every single Property, Member and Method used/owned by
a MasterPage inherits from either Control, UserControl or TemplateControl .

Since the UserControl, Page and MasterPage classes all are subclasses of System.Web.UI.

See :
http://quickstarts.asp.net/QuickStar...=System.Web.UI

When an HTTP request is made for a page at run time, the master page and content
pages are combined into a single class with the same name as the content pages.

The *resulting* compiled, merged class derives from the Page class.

The MasterPage class derives (inherits, actually) from Control,
and is last in a chain which includes Control, TemplateControl and UserControl:

Here's the inheritance hierarchy for the MasterPage class :

System..::.Obje ct
System.Web.UI.. ::.Control
System.Web.UI.. ::.TemplateCont rol
System.Web.UI.. ::.UserControl
System.Web.UI.. ::.MasterPage

The master page is initialized as the top control in a page's control hierarchy by
clearing the page's Controls array and adding the master page to the Control collection.

MasterPage inherits from UserControl...s o it's a form of UserControl.
If it looks like a duck and quacks like a duck and inherits from a duck...it's a duck.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== ========
"clintonG" <no****@nowhere .comwrote in message news:eE******** ******@TK2MSFTN GP04.phx.gbl...
So you should have no problem at all providing a URL from MSDN2 that definitively and without question documents the
typed Master as a User Control.

<%= Clinton Gallagher
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>"clintonG" <no****@nowhere .comwrote in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>Technically speaking, it should also be noted Mark is incorrect because the MasterPage is --not-- a User Control per
se but a unique type which functions similar to a User Control and then only when the page is compiled.

A MasterPage absolutely is a UserControl.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #8
"clintonG" <no****@nowhere .comwrote in message
news:eE******** ******@TK2MSFTN GP04.phx.gbl...

[top-posting corrected]
>>Technically speaking, it should also be noted Mark is incorrect because
the MasterPage is --not-- a User Control per se but a unique type which
functions similar to a User Control and then only when the page is
compiled.

A MasterPage absolutely is a UserControl.

So you should have no problem at all providing a URL from MSDN that
definitively and without question documents the typed Master as a User
Control.
No problem whatsoever:
http://msdn.microsoft.com/en-us/libr...asterpage.aspx

Note specifically:

Public Class MasterPage Inherits UserControl

public class MasterPage : UserControl

public ref class MasterPage : public UserControl

public class MasterPage extends UserControl

The directives that are valid on a master page are the same as those that
are available on a UserControl object.

Inheritance Hierarchy
System..::.Obje ct
System.Web.UI.. ::.Control
System.Web.UI.. ::.TemplateCont rol
System.Web.UI.. ::.UserControl
System.Web.UI.. ::.MasterPage
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #9
Dani you need to scroll down to 5/20 and get into the discussion: Do you
prefer Master Page or User Controls?

Mark --and others-- usually cite this document [1] but if you went to school
and learned to read like I did nowhere does the documentation definitively
state the Master --IS A-- User Control but MSDN documentation does --imply--
the Master is --LIKE A-- User Control because it supports the same
directives are inherited so to speak. Furthermore, it may be a stretch to
say the Master is --A TYPE OF-- User Control as usually stated but again,
the documentation does not say this. It is all implied leaving the matter up
for speculation.

Now speaking of "inheritanc e" get this...

The User Control can also be understood as a Mulatto Control: like being
born when one parent is a Negro and the other Caucasian then what race are
you?
I'll actually use this analogy but prefer a "safer" analogy which really
puts the matter of implication into perspective in the 5/20 discussion so
don't miss it, the fur may start to fly ;-)

<%= Clinton Gallagher

[1] http://msdn.microsoft.com/en-us/libr...asterpage.aspx
[2] http://en.wikipedia.org/wiki/Mulatto
"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:69******** *************** ***********@mic rosoft.com...
Thanks for the quick reply.
Is there a "Good" way to write a site that uses a master page and doesn't
make the menu reload every time ?
Dani
"Mark Rae [MVP]" wrote:
>"Dani" <Da**@discussio ns.microsoft.co mwrote in message
news:93******* *************** ************@mi crosoft.com...
Trying to create a master page that holds a menu, and the menu switches
between pages in the site. 2 problem arrose:

a. When I navigate from page to page (all AJAX Web Forms, with the
Master
pages as their master...) the entire page is refreshed - also the menu
which
belongs to the master, how can I fix it - so only the inside content
will
be
refreshed ?

I'm afraid you've made the "classic" newbie misconception about
MasterPages
that they are somehow the ASP.NET equivalent of framesets. They are
nothing
at all like framesets. In fact, a MasterPage is nothing more than a
special
kind of UserControl. When a content page is requested, it loads its
MasterPage control which it merges with its own markup and creates a
single
page. This happens every time. That's how MasterPages work...
b. When I try to put an AJAX enabled control that I've created inside
one
of
the page, I get an error - either I don't have a Script manager (which
is
located on the master page btw) or - if I add a script manager - that I
have
1 too many...
so - I damned if I do and damned if I don't...

http://aspalliance.com/1285_Tip_and_...Master_Pages.5
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #10

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

Similar topics

42
4016
by: (PeteCresswell) | last post by:
I skimmed the MS spiel at http://msdn.microsoft.com/sql/express, and noted the part about "all inside the Visual Studio 2005 environment". Do the older SQL server tools for security and stored procedure editing work too? -- PeteCresswell
5
2437
by: ggk517 | last post by:
We are trying to develop an Engineering application using PHP, Javascript with Informix as the back-end. Is it possible to retrieve data using Javascript but by accessing the Database. Say somebody enters part_no, than using Javascript is it possible to connect to the part master and retrieve the division and desc information? I am not allowed to use the PHP because this will require the user to insert the part number on the first...
9
2142
by: RBM007 | last post by:
Hello, I have created some pages in the (old) Atlas pages and migrated to AJAX version. After the update I noticed that any page containing ASP.NET AJAX won't compile anymore. Even if the same tags and properties are used in a page without a masterpage. Does anyone shares this exprerience with me or does anyone knows an answer? For the time being, I copy-pased the headings in my masterpage to the clield pages.
5
9013
by: Darth Continent | last post by:
Hello, I'm trying to replicate the functionality presented here specific to the ModalPopup control: http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx I've created a C# Ajax-enabled website project, have added the ScriptManager, ModalPopup, Panel and various Button controls, but although I've bound the ModalPopup to the button I want to have it use to activate my modal Panel, and though the project builds successfully, it...
4
6065
by: shamirza | last post by:
4 9 6 18.ATLAS-AJAX Note: - As an IT professional it's useful to know what the difference is between Hype and usefulness. For instance if there is a new technology coming in many programmers just want to implement it because they want to learn it?. But any new technology becomes useful if it is useful to the user. And Ajax is one of the technologies which will be useful as it really
2
3644
by: nicknack | last post by:
Hello. A little tricky situation: I have a master page. Inside that master page I have A div (With overflow:scroll) that contain an ajax updatePanel. Inside that updatePanel I have a tree. The problem is That if I scroll down the tree and then select a node. The tree jump back to the top. Because I'm inside a masterpage I don't have the "maintainScrollPositionOnPostBack".
2
5537
by: =?Utf-8?B?REo=?= | last post by:
I have a peculiar problem here that I did not have until I migrated from ASP.NET 2.0 to 3.5. I use a master page for my application. Because the master page uses update panels I have the scriptmanager control on the master page. Any pages in the app that uses the master page under 2.0 automatically used that script manager if any AJAX controls were involved. Everything was well with the world and we all sang ohmmmmmmmmmmmm.... After...
3
6958
by: Bobby Edward | last post by:
I had a simple admin form for "Categories"... Details View: To INSERT new Category Grid View: To View, Edit and Delete all Categories I decided to put the INSERT Details View inside of a ModalPopupExtender. PROBLEM 1: Dragging a ModalPopupExtender control to my webform gives me a gray box in Design View:
2
1862
by: Johnson | last post by:
While I have done a substantial amount of ASP.NET programming, I have only dabbled with AJAX (update panels and a 3rd party JSON setup - jayrock - that directly updates the DOM). In any case, I'm considering offering Web pages both to browsers that support AJAX and to those that do not support AJAX. Questions: 1. In general, should I look to offer two versions of each page - one for AJAX clients and the other for "non AJAX-supporting"...
0
8962
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8785
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9327
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...
0
9200
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...
0
8201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6747
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
4559
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2739
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2188
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.