• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1192
  • Last Modified:

Facebook like button is not displaying if the href has a dynamic conponent


I have a asp.net page with a repeater list on it containing Facebook like buttons.
The like buttons render ok in the repeater items if the href on all the like buttons are the same in all of the items, but if I place a query string component in the href it will only show the last item in the repeater.
e.g. the URL that will render the controls properly http://www.mysite.com/asppage.aspx
but putting querystring component http://www.mysite.com/asppage.aspx?querystring=uniqueID where unique id is unique number in each repeater list item
I have followed all of the facebook guides but nothing fixed this issue
I’m using the HTML5 version of the facebook like button
lblFaceBookLikeButton.Text = "<div class='fb-like' data-href='http://www.mysite.com/asppage.aspx?querystring=uniqueID '  data-send='true' data-width='450' data-show-faces='true'></div>";
any ideas?

  • 2
  • 2
1 Solution
Manoj PatilSr. Software EngineerCommented:
Can you put the piece of code of your repeater control.. where you are going to add like button ?
Manoj PatilSr. Software EngineerCommented:
Try this

"<div class='fb-like' 
data-href='http://www.mysite.com/asppage.aspx?querystring=<%# uniqueID %>'
data-send='true' data-width='450' data-show-faces='true'></div>";

Open in new window

johngrant_ksAuthor Commented:
I solved the problem by placing an & symbol at the end of my query string

e.g. http://www.mysite.com/mypage.aspx?uniqueID=21&

this seems to fix the problem

Feels like a bit of a work around hopefully it helps someone else.
johngrant_ksAuthor Commented:
It was the best solution to the problem thanks for posting your answers
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now