<ugc:ForEachComment runat="server">
<ugc:ContextVariable runat="server" Var="ugcComment.user.name"/>

By this I can print the name of the user who submitted the comment but now I want to store the name of the user in a variable in aspx page. How can I achive this?

I have tried creating the object of Comment class inside foreach comment but it gives the null reference error.

<ugc:ForEachComment runat="server">
<% Comment comment = new Comment();  %>         
   <%=  comment.User.Name; %>

While in a UGC ForEach loop you can use HttpContext.Current.Items to get the current rendered comment like this:


Hope this helps.

  • Thanks Daniel . It worked. <% Comment c = new Comment(); %> <% c = HttpContext.Current.Items["ugcComment"] as Tridion.ContentDelivery.UGC.Web.Model.Comment; %> <% string emailAddress = c.User.EmailAddress; %> – Meenakshi Apr 10 '13 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.