Solved

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

Posted on 2011-03-22
2
298 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now