Dynamically add page directive.

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" %>
LVL 1
HLRosenbergerAsked:
Who is Participating?
 
SAMIR BHOGAYTAConnect With a Mentor Freelancer and IT ConsultantCommented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
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
 
HLRosenbergerAuthor Commented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
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
 
HLRosenbergerAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.