Solved

Dynamically add page directive.

Posted on 2013-12-04
5
384 Views
Last Modified: 2013-12-07
Is there away to Dynamically add this to a page, either using web.config, or code behind:  


<%@ Master Language="vb" AutoEventWireup="false"  CodeFile="TaborModalPopup.master.vb" Inherits="Tabor.UI.TaborModalPopup" %>
0
Comment
Question by:HLRosenberger
[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
  • 2
5 Comments
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39696229
Which directive you need to add? the entire markup? I don't think that's something that you can do within boundaries of ASP.Net?

Can you throw some light on what exactly you are trying to achieve?
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39696356
I need to add CodeFile and Inherits.  I'm using a Third-Party product that generated code.  Problem is there is no "hook" so to speak to add the directives.  So each time I regenerate, my directives are gone.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39696375
Hmmm I don't think it is possible during the runtime. You might want to write a little utility that can change these directives for you. Does that third party product has support to include these directives?

I could be wrong here but as long as I know there is no way to dynamically do this during the runtime.
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 500 total points
ID: 39700316
hi..
You can set the MasterPageFile Property from Code

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit Me.MasterPageFile = "~/Site.master"
End Sub

Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)
Me.MasterPageFile = "~/Site.master" MyBase.OnPreInit(e)
End Sub
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 39703500
thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
MYSQL responding very slow 3 50
asp.net mvc , views, hidden values ? 2 23
c#, datatable, aspx 4 20
Check only one toolstripmenu item 12 27
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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