Tuesday, October 26, 2010

Twitter Tweet, Facebook Like code C# gridview

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" RowStyle-Font-Bold="true"
RowStyle-Font-Size="13" RowStyle-Font-Names="Arial"
DataKeyNames="linkid" DataSourceID="AccessDataSource1" width="90%">
<columns>
<asp:templatefield headertext="Popular Likes">
<itemtemplate>
<li><a href="'default2.aspx?id="<%#">'><%# Eval("linkdesc") %> </a>
<br />
<iframe src="http://www.facebook.com/plugins/like.php?href="http://www.vvvvvv.com/fblike/default2.aspx?id="<%#"> &amp;layout=button_count&amp;show_faces=false&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21&amp;width=100&amp;locale=en_US' scrolling='no' frameborder='0' allowTransparency='true' style='margin-left:15px; height:21px; width:95px;'></iframe>'
  
<a href="http://twitter.com/share" class="twitter-share-button" url="http://www.bigtechie.com/fblike/default2.aspx?id=<%# Eval(">" data-text='<%# Eval("linkdesc") %>' data-count="none" data-via="rajeevkum">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>


</li>
<br />
</itemtemplate>
</asp:TemplateField>
</columns>
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="e:\fblike.mdb"
SelectCommand="SELECT [linkid], [linkdesc],[linkfblk] FROM [linkdesc] where linkid<>3 order by linkid desc">
</asp:AccessDataSource>

1 comment:

CompComputer said...

Hello,
I'm attempting to test and utilize this code inside a gridview. I'm receiving the following error message:

Compiler Error Message: CS1010: Newline in constant


Line 19: href="'default2.aspx?id="<%#">'><%# Eval("linkdesc") %>

Any idea how to get around this error?