2017-02-09 41 views
0
<asp:DataList ID="dtList" RepeatColumns="1" runat="server" OnItemDataBound="dtList_ItemDataBound"> 
    <ItemTemplate> 
     .. 
     <div> 
      <asp:LinkButton runat="server" ID="lblsuggestion" OnClick="lblsuggestion_Click" Text='<%# Eval("Suggestion") %>' /> 
     </div> 
     <div> 
      <a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank"> 
       <img src="Images/facebook.png" /></a> 
     </div> 
    </ItemTemplate> 
</asp:DataList> 


<script> 
    function fbs_click() { 
     u = location.href; 
     t = document.title; 
     d = document.description; 
     i = document.image; 
     window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t) + '&d=' + encodeURIComponent(d) + '&i=' + encodeURIComponent(i), 'sharer', 'toolbar=0,status=0,width=626,height=436'); 
     return false; 
    } 
</script> 

我分享頁面的URL,我加入Facebook分享按鈕,每一個數據列表項目,但我不能在URL年底建成會話。我如何添加它?Facebook的分享會議在DataList控件項目

例如我現在的網址 - >/help.aspx?Suggestion = 9weK24GUykXJUd1GhSwwvw%3d%3d 這總是會進入同一個頁面並且沒有匹配。

我該如何添加位置href到會話?

回答

0

如果會話存在,您可以將其添加到模板中的url結尾。

<a href="http://www.facebook.com/share.php?u=<url>&session=<%=Session["yourSession"].ToString() %>"