Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Plus in an ASP.NET User Control
    text
    copied!<p>I have an ASP.NET 4.0 home page which displays about 20 product listings. Each product listing leads to a url in the format: <code>/DisplayProduct.aspx?ProdID=X</code></p> <p>I want to display how many Google Plus and ReTweets each product listing received, in front of each listing. How can I do it in the best optimized manner and without affecting the page load speed too much. What scripts have to be used?</p> <p>Here's the User Control with the code</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductListing.ascx.cs" Inherits="Controls.ProductListing" %&gt; &lt;asp:GridView ID="gvProducts" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="objProds" PageSize="10" ShowHeader="False" OnRowDataBound="gvProducts_RowDataBound" OnRowCommand="gvProducts_RowCommand" &gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Product List"&gt; &lt;HeaderStyle /&gt; &lt;ItemTemplate&gt; &lt;div class="plist"&gt; &lt;table cellpadding="0" cellspacing="0" style="width: 100%;"&gt; &lt;tr&gt;&lt;td&gt; &lt;div class="productname"&gt; &lt;asp:HyperLink runat="server" ID="hypName" Text='&lt;%# Eval("Name") %&gt;' NavigateUrl='&lt;%# "~/DisplayProduct.aspx?ID=" + Eval("ProdID") %&gt;'/&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div class="productdesc"&gt; &lt;b&gt;Description: &lt;/b&gt; &lt;asp:Literal runat="server" ID="lblDesc" Text='&lt;%# Eval("Description") %&gt;' /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload