Solved

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

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

707 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