This project is read-only.

Embed a Widget in single page/post

May 26, 2014 at 9:51 AM
Hi all, as wrote on post, is there a way to include one or more widget in a single page/post like user control (ex: [usercontrol: ~/path/to/my_user_control.ascx] ) ?
Thank you!
May 30, 2014 at 5:37 PM
Please look up the existing extension named BreakPost. I believe this may be similar to what you are trying to accomplish or at least help you get there.
May 30, 2014 at 6:01 PM
Hi Ildrago,

You can inject them on a page or post :)

Look here:

The first page is an actual page but I injected the post control in it.

So its a page with the post list control injected on it.

You can even create your own controls and inject those too.
Jun 4, 2014 at 4:53 AM
Thank you guys, I appreciate your suggestion :)
Kbdavis, how did you inject post list, because this is what I need.
Jun 4, 2014 at 1:10 PM
Hi Ildrago,

Here is the code you put in your post or page:

[usercontrol:~/User controls/PostList.ascx ]

Trick here is your path have to be exact even with spaces and etc.

If it is off just a little bit it does not work.

Found this out the hard way, but having exact path works.
Jun 5, 2014 at 11:49 AM

I've got the same problem. I just want to implement an usercontrol into every post.
I used above code and get following Error:
ERROR - UNABLE TO LOAD CONTROL : ~/User controls/Test.ascx

The following code demonstrate what I did.
    private static string AppendBody(string Body)
        string hBody = Body;
        StringBuilder sBuild = new StringBuilder();
        sBuild.AppendLine("[usercontrol:~/User controls/Test.ascx]");

        hBody = hBody + sBuild.ToString();
        return hBody;
The Test.ascx is a very new Control just created with VS 2014 and without any changes.

Best Regards Jürgen
Jun 5, 2014 at 1:44 PM
Edited Jun 5, 2014 at 1:48 PM
Hi Jab33699,

If you need it for every post then you need to put the control in your post theme template.

The code [usercontrol:~/User controls/Test.ascx] will only work in an individual post entered in the post editor.

To have your usercontrol in post.aspx in root folder you need to register it and then include it.

Like this:

<%@ Register Src="Custom/Controls/CommentView.ascx" TagName="CommentView" TagPrefix="uc" %>

<uc:CommentView ID="CommentView1" runat="server" />


That should work :)