asp.net - Web Application Project @Reference tag -


I'm converting a web site project to a web application project in VS 2008 and I'm just about a dynamic loading The query has participated in the user control.

  & lt;% @ reference control = "~ / UserControls / MyUserControl.ascx"%>  

And then in the page I am just called ...

  Due ucSupplier New ASP. Eententolols_Murcentral_sc as Description  

Sadly, when updating to a web appraisal project, it is no longer a valid line. Is there any alternative?

There is an option to dynamically load your user controls:

  New User Control ucSupplierDetails.LoadControl ("~ / UserControls / MyUserControl.ascx") Description as placeholder. Control. Add (ucSupplierDetails)  

Edit: Here's one other option, keep your user controls in a namespace manually:

  Namespace MyUserControlNamespace Public Class MyUserControl Inherits System. Web.UI.UserControl End Class End Namespace  

Do not forget to change your user control class declaration (attribute inheritance in the last line):

  & Lt;% @ Control language = "VB" AutoEventWireup = "true" CodeFile = "MyUserControl.ascx .vb" Inherits = "MyUserControlNamespace.MyUserControl"% & gt;  

And now, you can access it in your namespace:

  Due ucSupplier Details as New MyUserControlNamespace.MyUserControl  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -