Solved

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

Posted on 2011-03-22
2
302 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
2 Comments
 
LVL 3

Accepted Solution

by:
_kiwi_ earned 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

840 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