?
Solved

How can i make change to my content page method as "GET".

Posted on 2011-03-22
2
Medium Priority
?
305 Views
Last Modified: 2012-05-11
How can i make change to my content page method as "GET".
I don't want to change from master page. Can we override method in content page?
0
Comment
Question by:rohitnet100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
_kiwi_ earned 2000 total points
ID: 35197241
I'm not sure what you mean as "GET".

In a page, whatever the master page, you can get all content you want in content place holders in your master page and declare a replacement content block it only if needed in your page.

As for overriding methods, you can of course define any method you need in content pages, even override System.Web.UI.Page methods without any problem.

One thing though is that you can not override methods from your master page since you don't inherit from it, you just refer to it as a container.

If you want to have conditional behavior in your master page depending on the page refering to it you can:
- define a public property (like a boolean) with a default value in your master page
- condition the execution or the display of elements in your master page on this value
- in your content page, take the value of the MasterPageFile="~/Site.Master" attribute on the <%@Page .../> directive and add a <%@ MasterType VirtualPath="~/Site.Master" %> (replace Site.Master with your master page file) element in your page, once this is done, the Page.Master property will be typed according to the master page selected, and you will have access to the new master page property you created.
- in the code behind of the content page (or in a script runat="server" block), either get an event registered on preinit, load, prerender, or any other usefull page lifecycle function, and define the property as: Master.MyProperty = myValue;

(remember that if you condition display of elements in your master page using databound expressions (e.g. Visible='<%# MyProperty == myValue %>') you will need to call a databind at the page level to ensure these are evaluated)

And you should be set.

So in the end the options are:
- define content blocks in your master page that you will override or not, depending on the page
- add properties and behaviors to your master page in order to control it from your page

Hope this helps,
Julien
0
 

Author Closing Comment

by:rohitnet100
ID: 35226678
thanks
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question