Solved

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

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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