How to access Master page members(like properties) from child page.(interviews.dotnetthread.com)

submitted by abomnkvabomnkv(250) 3 years, 2 months ago

To Access public members like Property of a Master Page in Child Page we need to specify @MasterType directive with virtualpath attribute pointing to MasterPage path. i.e Use the @MasterType directive to set the strong type for the master page, as accessed through the Master property. MasterPage: public string masterVariable = "interviews.dotnetthread.com". .... Child Page: <%@ Page Language="C#" MasterPageFile="~/master/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="menu_master_Default" Title="Untitled Page" %> <%@ MasterType VirtualPath="~/master/MasterPage.master" %> Then in Page_Load we can access as below sting childVar = this.Master.masterVariable;

add a comment |category: |Views: 12

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story