Regular case, lower case etc.. nothing makes any difference. It loads the user control associated to the macro.. but the value of the ToutId property is never set!
Any insight into how this might be achieved would be great.
Just to follow up.. I changed my ItemTemplate to have a PlaceHolder inside of it.. and then create the macro via code in the OnItemDataBound event.. then add the macro to the placeholder. It works. However I have to set the attribute using the Attributes not the MacroAttributes.
Why can't I access the macro directly from the ItemTemplate.. why do I have to create it in code and then add it to a placeholder to have the attributes actually work?
Hi, Mike. It happens because actually macro control attributes are copied to parameters earlier than ItemDataBound happens. You can workaround it by setting the attributes you need on the ItemCreated event instead of the ItemDataBound one.
Setting macro attributes in code behind not setting value
I have a macro within a regular asp:repeater control.
In the ItemDataBound event handler I am attempting to set the macro's attributes that point to a custom public property that is exposed.
macro.Attributes.Add("toutid", node.Id.ToString());
or
macro.MacroAttributes.Add("toutid", node.Id);
Regular case, lower case etc.. nothing makes any difference. It loads the user control associated to the macro.. but the value of the ToutId property is never set!
Any insight into how this might be achieved would be great.
Thanks
Just to follow up.. I changed my ItemTemplate to have a PlaceHolder inside of it.. and then create the macro via code in the OnItemDataBound event.. then add the macro to the placeholder. It works. However I have to set the attribute using the Attributes not the MacroAttributes.
Why can't I access the macro directly from the ItemTemplate.. why do I have to create it in code and then add it to a placeholder to have the attributes actually work?
Hi, Mike. It happens because actually macro control attributes are copied to parameters earlier than ItemDataBound happens. You can workaround it by setting the attributes you need on the ItemCreated event instead of the ItemDataBound one.
is working on a reply...