i am trying to have like button for every product in datalist, and i did these
<fvk:likebutton ID="Likebutton3" runat="server" Url=' <%# "http://mywebsite.com/index.aspx#"+DataBinder.Eval(Container.DataItem, "ID")%>' />
<fvk:likebutton ID="Likebutton3" runat="server" Url=' <%# "http://mywebsite.com/index.aspx?m="+DataBinder.Eval(Container.DataItem, "ID")%>' />
but finally they refer to mywebsite.com, and when i like one of them all liked.
Please help i need this badly.
--------------------------------------------------------
---------------------------------------------------------
Update 5/11/2013
I understood that it is impossible do this task without Meta Data, so i provided below code which solve most part of my problems, but that rise new one.
My Index.aspx page
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="index4.aspx.cs" Inherits="Winner.index4" %>
<%@ Register TagPrefix="fvk" TagName="subscribe" Src="~/FVK/SubscribeToEvent.ascx" %>
<%@ Register TagPrefix="fvk" TagName="likebutton" Src="~/FVK/LikeButton.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="MyStyle/index.css" rel="stylesheet" />
<script type="text/javascript" src="Scripts/jquery-1.9.1.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel ID="PublishLabelUpdatePanel" runat="server">
<ContentTemplate>
<fvk:subscribe ID="subscribe1" EventName="Like" runat="server" önEventTrigger="OnLike" />
<fvk:subscribe ID="subscribe2" EventName="Unlike" runat="server" önEventTrigger="OnUnlike" />
<div style="padding:3px;padding-removed24px;padding-removed6px">
<asp:Label ID="EventLabel" runat="server" ForeColor="Green"></asp:Label>
<br />
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="holder" class="div_listview">
<asp:DataList ID="DataList1" CssClass="DataListCoundown" runat="server">
<ItemTemplate>
<div class="divlistitem">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#"GetImage.aspx?id="+Eval("IDproduct") %>' Width="400px"/>
<br />
<fvk:likebutton ID="Likebutton3" runat="server" Send="true" Url='<%#"http://www.mywebsite.com/Like.aspx?ID=" + Eval("ID")%>' Width="400" />
</div>
</ItemTemplate>
</asp:DataList>
</div>
</asp:Content>
My Like.aspx codebehind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace Winner
{
public partial class like : System.Web.UI.Page
{
class show
{
public long ID { get; set; }
public long IDproduct { get; set; }
public string Name { get; set; }
public byte[] Image { get; set; }
public DateTime Time_end { get; set; }
public int Seconds { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string productName = "";
string productImageURL = "";
string productDescription = "";
int ShowID = 0;
if (Request.QueryString["ID"] != null)
{
ShowID = Convert.ToInt32(Request.QueryString["ID"]);
}
if (Request.QueryString["ID"] != null)
{
DBCardEntities context = new DBCardEntities();
List<show> showList = new List<show>();
var ListShow = (from s in context.LikeShows
join p in context.Products on s.Product_ID equals p.ID
where s.ID == ShowID
select new { s.ID, p.Description, p.Name, p.Image, s.Time_End, s.Time_Start, productId = p.ID }).FirstOrDefault();
ShowID = Convert.ToInt32(Request.QueryString["ID"]);
productName = ListShow.Name;
productImageURL = "GetImage.aspx?id=" + ListShow.productId.ToString();
productDescription = ListShow.Description;
}
HtmlMeta _metaTitle = new HtmlMeta();
_metaTitle.Name = "og:title";
_metaTitle.Content = "Product: " + productName;
this.Header.Controls.Add(_metaTitle);
HtmlMeta _metaURL = new HtmlMeta();
_metaURL.Name = "og:url";
_metaURL.Content = "http://piraly.cnsuite.com/index4.aspx?ID=" + Convert.ToString(ShowID);
this.Header.Controls.Add(_metaURL);
HtmlMeta _metaImage = new HtmlMeta();
_metaImage.Name = "og:image";
_metaImage.Content = Convert.ToString(productImageURL);
this.Header.Controls.Add(_metaImage);
HtmlMeta _metaDescription = new HtmlMeta();
_metaDescription.Name = "og:description";
_metaDescription.Content = Convert.ToString(productDescription);
this.Header.Controls.Add(_metaDescription);
}
}
}
}
and the problem is that even by setting the url in metadata the url stays Like.aspx?ID=a number.
Also, i tried to set the metadata in index4.aspx but it had other problems.
Do have any idea ?
i will appreciate your help thank you.