Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6356309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:56:17+00:00 2026-05-24T22:56:17+00:00

I have an UpdatePanel which has a gridview inside it. On each of the

  • 0

I have an UpdatePanel which has a gridview inside it. On each of the gridviewrows, within the gridview, I have a Twitter and FaceBook button.

The gridview renders fine with the buttons on page load, however, once a partial postback is done on the updatepanel the Twitter and FaceBook buttons do not render.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
<!-- search controls.... -->
 <asp:ImageButton ID="btnSearch" ImageUrl="~/img/button-search.gif" runat="server" />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" EnableModelValidation="True"
                BorderStyle="None" Font-Size="Small" GridLines="None" AllowPaging="True" ShowFooter="True"
                Width="100%" OnPageIndexChanging="GridView1_PageIndexChanging">
                <RowStyle CssClass="row1" />
                <AlternatingRowStyle CssClass="row2" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            ...
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Literal ID="ltlTwitter" runat="server" Text='<%# GetTwitterURL(Eval("ID"), Eval("SomeText")) %>'></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Literal ID="ltlFacebook" runat="server" Text='<%# GetFacebookURL(Eval("ID")) %>'></asp:Literal>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" Visible="False" />
                </Columns>
                <EmptyDataTemplate>
                    <strong>There are no offers for this search criteria.</strong>
                </EmptyDataTemplate>
            </asp:GridView>
</ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnSearch" />
        </Triggers>
    </asp:UpdatePanel>

Relevant C#:

public static string GetTwitterURL(object ID, object text)
{
    ...           
    StringBuilder sb = new StringBuilder();
    sb.Append("<div>");
    sb.Append("<a href=\"http://twitter.com/share\" " +
        "class=\"twitter-share-button\" ");
    sb.AppendFormat("data-url=\"{0}?ID={1}\" ", obj.Property, oID.ToString());
    sb.Append("data-via=\"xxx\" ");
    sb.AppendFormat("data-text=\"{0}\"", xxx);
    sb.Append("data-count=\"none\">Tweet</a>");

    sb.Append("</div>");

    return sb.ToString();

}

public static string GetFacebookURL(object OfferID)
{
    ...

    return string.Format("<fb:like href=\"{0}?ID={1}\" " +
        "send=\"false\" layout=\"button_count\" show_faces=\"false\" " +
        "action=\"like\" font=\"tahoma\"></fb:like>", obj.Property, someInt);
}

Also, the page in question is a child page of a master page.

Here is the additional code-behind:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        this.BindOffersGrid(true);
    }
}

public List<Offer> CurrentOffersDataSet
{
    get
    {
        object o = ViewState["CurrentOfferDataSet"];
        return (o == null ? new List<Offer>() : (List<Offer>)o);
    }
    set
    {
        ViewState["CurrentOfferDataSet"] = value;
    }
}

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    GridView1.DataSource = this.CurrentOffersDataSet;
    GridView1.DataBind();
}

private void BindOffersGrid(bool ApplyRandomSort)
{
    List<Offer> lstOffers = Offers.GetAllBySearchCriteria(
        Convert.ToInt32(ddlOfferCounty.SelectedValue), 
        Convert.ToInt32(ddlOfferTypes.SelectedValue),
        Convert.ToDateTime(ddlOfferDate.SelectedValue), -1, true);

    ...
    //Some filtering of the dataset with Linq
    ...

    GridView1.DataSourceID = string.Empty;
    this.CurrentOffersDataSet = lstFilteredOffers.
        OrderByDescending(a => a.IsExclusive).
        ThenBy(a => Guid.NewGuid()).
        ToList();
    GridView1.DataSource = this.CurrentOffersDataSet;
    GridView1.DataBind();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:56:18+00:00Added an answer on May 24, 2026 at 10:56 pm

    Ok, I added the following code at the very end of my child page and now the Twitter and FaceBook like button are appearing after partial postbacks.

    <script type="text/javascript">
    
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            prm.add_pageLoaded(pageLoaded);
    
            var _panels, _count;
    
            function pageLoaded(sender, args) {
                if (_panels != undefined && _panels.length > 0) {
                    for (i = 0; i < _panels.length; i++)
                        _panels[i].dispose();
                }
    
                var panels = args.get_panelsUpdated();
    
                if (panels.length > 0) {
    
                    updateFbLike();
                }
            }
    
            function updateFbLike() {
                $.getScript("http://platform.twitter.com/widgets.js");
                FB.XFBML.parse();
            }
    
    
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview within an updatepanel which allows paging and has a linkbutton
I have an UpdatePanel which has a Repeater inside it, and inside of the
Within an ASP.NET AJAX UpdatePanel on my page I have a submit button which
I have an updatepanel which after clicking one button is submitting the page. The
I have a GridView which is continually rebound using a timer and is within
I have several dropdownlists and textboxes inside an <asp:UpdatePanel> , which should let me
We have a structure which has 3 main UpdatePanels, each of which has several
I am using a GridView within an updatepanel. I have gridview generated edit and
I have TextBox (multiline) and Label in an UpdatePanel which I refresh with javascript
I have a form which is in an updatePanel and I have a span

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.