U4-3431 - Macro property not passed to ASCX usercontrol

Created by Rick Mason 06 Nov 2013, 16:40:12 Updated by Rick Mason 11 Nov 2013, 10:00:54

I have created an ASCX file and saved it in the ~/usercontrols folder, with its DLL in the ~/bin folder. I create a macro and specify ~/usercontrols/Example.ascx in the Macro Properties > usercontrol box. I can add this macro to a template and it works.

The code-behind for the ASCX has a public property defined as:

public string ExampleProperty { get; set; }

The ASCX file itself has the following line:

<%= ExampleProperty %>

I click on my macro and go to the Parameters tab. I create a parameter as follows:

Alias: ExampleProperty Name: Example Type: Textbox

On my template I add the the macro using the toolbar, and am prompted for a value for the "Example" property. It inserts this line in the template:

@Umbraco.RenderMacro("ExampleUsercontrol", new )

However when the page is rendered, ExampleProperty on the ASCX usercontrol is an empty string. It has not received the value from the Umbraco template.


Shannon Deminick 07 Nov 2013, 05:36:42

@Rick, I'm assuming that this works fine in 6.x ?

Rick Mason 07 Nov 2013, 09:58:11

Yes. I don't have a working 6.0 setup at the moment, but I used 6.0 on the L2 training course recently and the workbook shows we followed these steps. The only difference was we used the WebForms engine and converted to MVC later.

Rick Mason 07 Nov 2013, 10:57:37

I've just installed Umbraco v6.1.6 using exactly the same setup and test code. Yes, it works.

Shannon Deminick 10 Nov 2013, 23:06:02

Thanks rick! Will have this fixed today.

Shannon Deminick 11 Nov 2013, 01:24:06

Fixed in revs: a311a54d3d477ed56eb59cb59feaad85d949c174, 6fe647146c6126a425f79fe346a50a0c17b003c2

Thanks for finding this, would have caused some headaches :)

Rick Mason 11 Nov 2013, 10:00:54

Brilliant, thank you!

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.0.0

Due in version: 7.0.0


Story Points: