如何为radsocialshare facebook按钮创建动态网址?
我有一个radsocialshare facebook像radgrid项目中的按钮,当我点击像radgrid项目的按钮时,项目网址将在Facebook中分享为〜/ page.aspx?id = 1
注意:ID将根据radgrid项目自动生成
答案 0 :(得分:0)
绑定控件的UrlToShare属性(例如在ItemDataBound事件中)更容易,或者set it on the client(在这种情况下你不能使用〜/作为root,你需要一个客户端可用的URL )如果网格上方/下方只有一个实例。
答案 1 :(得分:0)
在radgrid的ItemCreated事件中,您可以像这样设置UrlToShare属性:
Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemCreated
Dim RadSocialShare1 As RadSocialShare = e.Item.FindControl("RadSocialShare1")
If RadSocialShare1 IsNot Nothing Then
'In this example, "ID" is a field in the data bound to the radgrid
Dim myID as string = DataBinder.Eval(e.Item.DataItem, "ID")
'Now Make the Url
Dim myUrl as string = "~/page.aspx?id=" & myID
RadSocialShare1.UrlToShare = myUrl
End If
End Sub