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.



Comments (1) -

essays
essays
5/20/2012 4:33:14 PM #

I am new with BlogEngine and to be honest, I am still having lots of difficulties and confusions. Thanks a lot for your article because at least now, I have some ideas. I will follow your instructions and hopefully that will resolve my issues. I am hoping to launch my site at the end of the month.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading