0

I am facing problem for rendering the anchor by using the glass mapper in sitecore mvc.

This is the code I have used to render the link:

@RenderLink(promoWidget, x => promoWidget.Link, new System.Collections.Specialized.NameValueCollection { { "target", promoWidget.Link.Target },{"class",promoWidget.Link.Class}}, true, contents: promoWidget.Link.Text) 

But when from sitecore we select the link and click on insert anchor I put the text and anchor text. When I display this link by using above code it will render link this:

<a href="product#product" class="link">product</a>

It is showing 2 times product#product. I want to display only once #product.

How can I do this?

Appreciate the help

Thanks, Amol

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
  • sorry I missed the anchor tag product – Amol Shimpi Apr 14 '15 at 10:59
  • What is the value of your "promoWidget.Link" in Sitecore? – Craig Taylor Apr 16 '15 at 13:25
  • In the sitecore , there is general link field is there there we are clicking on Insert Anchor and we are giving value of Text= Product and Anchor= Product. and by using @Renderlink we displaying the link – Amol Shimpi Apr 16 '15 at 14:11
  • Are you seeing this behavior in page editor or when previewing/viewing live version? I duplicated your test and saw that page editor was duplicating my link.text, but the href was right. When viewing preview version, it rendered correctly. – Craig Taylor Apr 16 '15 at 15:39
  • @CraigTaylor I am seeing this behaviour in live version. I don't know how it is rendering twice . please can u help me on this ASAP. – Amol Shimpi Apr 16 '15 at 18:33
  • Try changing the text and anchor text to distinct values. (producta and productb, respectively) This will help give us clues to what piece of content is being duplicated. – Craig Taylor Apr 23 '15 at 13:44
  • @CraigTaylor Hi, It will replace Anchor text. like if we give anchor text as ProductDetail then href is replaced by ProductDetail#ProductDetail. – Amol Shimpi Apr 27 '15 at 07:25

0 Answers0