How To Pass A Parameter To A Custom User Control In BlogEngine.net 2.5



TODO:

Have you ever wanted to use a Custom Control in BlogEngine.net, and also pass a parameter to that UserControl?

 

SOLUTION:

Create a Page or Post, and put the following line right into the editor.

 

ERROR - UNABLE TO LOAD CONTROL : ~/User Controls/MyGallery.ascx ImageDir=/blah/blah; MyOtherProp=blah;

 

 

NOTES:

The example above loads the MyGallery.ascx control from the "User Controls" directory, and set the properties on the UserControl named "ImageDir" and "MyOtherProp".

The above example assumes you have created the properties "ImageDir" and "MyOtherProp" on your UserControl.