Reputation: 4323
To explain confusing title, here is the deal. I have user control which has Like button in it, and I load this User control dynamically multiple times on my homepage. When loading it dynamically I set src of like button iframe dynamically too, here is the method:
public void SetLikeButton(int ID)
{
facebookIframe.Attributes["src"] = "//www.facebook.com/plugins/like.php?href=" + HttpUtility.UrlEncode("http://www.sample.com/subpage/" + ID.ToString()) +
"&send=false&layout=box_count&width=50&show_faces=false&action=like&colorscheme=light&font&height=90";
}
But when I press any of Like buttons, only domain name is gets "liked" on user profile. I need it to share full path,rather than just domain name.Is that possible?
Upvotes: 1
Views: 482
Reputation: 26
Can't help on the iframe version but this is based on the HTML5 version at
https://developers.facebook.com/docs/reference/plugins/like/
Div Tag for the markup
<div id="fbdiv" class="fb-like" data-href="" data-send="true" data-width="450" data-show-faces="true" runat="server"></div>
In pageload of control
fbdiv.Attributes["data-href"] = "http://www.yoursite.com";
If the control gets loaded multiple times add a parameter to change the URL
Upvotes: 1