Browser is reloading when i click on anchor href

Khathun s asked on February 10, 2017 11:20

Hi team,

I have a left navigation anchor links in left side and content in right side, if we click on Left link it should go to appropriate section in same page.for left navigation i used Repetar webpart and right side content i used 4 universal page viewers web parts.It is working fine in chrome and Firebox and IE the page is loading one more time when i click on left link and selected item is also not highlighting.My Left navigation code is

<li <%# DataItemIndex == 0 ? "class='contactus-left-pane-list contactus-left-pane-is-active'":"class='contactus-left-pane-list'" %>> <a href='<%# Eval("MenuItemURL") %>' target='<%# Convert.ToBoolean(Eval("NewTab")) == true ? "_blank":"_parent" %>'><%# Eval("MenuItem") %> <i <%# DataItemIndex == 0 ? "class='fa fa-angle-right hide-for-small show-for-medium show-for-large'":"class='fa fa-angle-right'" %> aria-hidden="true">

MenuItemURL field i am passing id and my right content Code i am taking a div in that i am passing id same what ever i passed in MenuItem.

Please help me.

Correct Answer

Roman Hutnyk answered on February 10, 2017 14:45

I can see target attribute is set for a link - have you tried to remove it?

1 votesVote for this answer Unmark Correct answer

Recent Answers

Roman Hutnyk answered on February 10, 2017 12:06

Could you please provide rendered markup? If there is only ID in the MenuItemURL field than you need to add a hash tag in front of it: <a href='#<%# Eval("MenuItemURL") %>'

0 votesVote for this answer Mark as a Correct answer

Khathun s answered on February 10, 2017 12:23 (last edited on February 10, 2017 14:20)

Hi Roman Hutnyk,

in my rendered code am taking a Div and giving ID for that div and i am matching Div id with Left Navigation id <div id="MenuURL"> and i am passing # in MenuURL field of page type

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.