2012-01-16 31 views
0

我有一個用戶控件聲明一個asp.net web表單鏈接控件如下:將Google+旁邊ASP.NET超鏈接

<asp:HyperLink runat="server" ID="lnk" CssClass="title" Text='<%# Eval("PostTitle") %>' 
        NavigateUrl='<%# "~/DisplayPost.aspx?ID=" + Eval("ID") %>'/> 

我要新增一個谷歌+按鈕,這一點,並通過動態地將網址導航到Google+按鈕。我怎樣才能做到這一點?

回答

1

請參閱Google+ button page來執行此操作。一個例子,你會是如下:

<!-- Place this tag where you want the +1 button to render --> 
<g:plusone annotation="inline" href="<%# "~/DisplayPost.aspx?ID=" + Eval("ID") %>"></g:plusone> 

<!-- Place this render call where appropriate --> 
<script type="text/javascript"> 
    (function() { 
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 
    po.src = 'https://apis.google.com/js/plusone.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 
    })(); 
</script> 

也有直接把你的鏈接後進入的網頁上加1按鈕的選項。

+0

這不能在用戶控件中工作..給出一個iframe錯誤 – 2012-01-16 04:42:54