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 6681755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:37:34+00:00 2026-05-26T04:37:34+00:00

I have a GridView in an update panel. The GridView is styled so that

  • 0

I have a GridView in an update panel.

The GridView is styled so that each alternate row is a different colour.

When I change page on the GridView it loses the alternate row colouring. All other styles are maintained.

If I remove the update panel the GridView keeps the alternate row colouring after changing page.

Does anyone have any idea on what may be causing this or how to fix it?

Thanks,
Neil

EDIT:

Here is the aspx code

<div id="active-logbooks" class="tab-content clearfix">
    <div class="left-column">
        <asp:MultiView runat="server" ID="mlvLogbooks" >
            <asp:View runat="server" ID="vActiveLogbooks">
                <asp:GridView PagerSettings-Mode="NextPrevious" PagerSettings-Position="Top" PagerSettings-NextPageImageUrl="~/img/right-arrow.png" PagerSettings-PreviousPageImageUrl="~/img/left-arrow.png" AllowPaging="true" runat="server" ID="gvActiveLogbooks" PageSize="5" AutoGenerateColumns="false" CssClass="lesson stripe-me" OnRowDataBound="gvActiveLogbooks_RowDataBound" OnPageIndexChanging="gvActiveLogbooks_PageIndexChanging">
                    <Columns>
                        <asp:BoundField HeaderText="Logbook number" DataField="LogbookNumber" ItemStyle-CssClass="border" ItemStyle-Width="100" />
                        <asp:BoundField HeaderText="Origin" DataField="Origin" ItemStyle-CssClass="border" ItemStyle-Width="100" />
                        <asp:BoundField HeaderText="Order Reference" DataField="OrderReference" ItemStyle-CssClass="border" ItemStyle-Width="100" />
                        <asp:TemplateField HeaderText="Transfer Date">
                            <ItemTemplate>
                                <asp:Literal runat="server" ID="lblTransferDate" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:HyperLink runat="server" ID="lnkTransferLogbook" CssClass="border" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <a href="javascript:__doPostBack('ctl00$MainMaster$gvActiveLogbooks','Page$Prev')" id="lnkGridviewPrev" runat="server" class="left-arrow">Previous</a><asp:Literal runat="server" ID="litBreaker" Text=" |" />
                <a href="javascript:__doPostBack('ctl00$MainMaster$gvActiveLogbooks','Page$Next')" id="lnkGridviewNext" runat="server" class="right-arrow">Next</a>
            </asp:View>
        </asp:MultiView>
    </div>

And this is the function that is called when the page change occurs:

protected void gvActiveLogbooks_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    HideShowGridViewPagerLinks(e.NewPageIndex);
    gvActiveLogbooks.DataSource = _logbooks;
    gvActiveLogbooks.PageIndex = e.NewPageIndex;
    gvActiveLogbooks.DataBind();
}

Nowhere on the page is there anything done with colouring the GridView rows

    protected void gvActiveLogbooks_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType != DataControlRowType.DataRow)
        return;

    Literal transferLabel = (Literal)e.Row.Cells[(int)ActiveLogbookGridViewColumns.TransferDate].FindControl("lblTransferDate");
    transferLabel.Text = _logbooks[e.Row.RowIndex].TransferDate.ToShortDateString();

    HyperLink transferLink = (HyperLink)e.Row.Cells[(int)ActiveLogbookGridViewColumns.TransferLink].FindControl("lnkTransferLogbook");
    transferLink.Text = TransferLinkText;
    transferLink.NavigateUrl = "TransferLogbooks.aspx?id=" + Guid.NewGuid();
}
  • 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-26T04:37:35+00:00Added an answer on May 26, 2026 at 4:37 am

    I’m guessing that some interaction between your CSS classes and the postback is messing this up. What happens if you switch to the RowStyle and AlternateRowStyle tags (example here), and reference your CSS classes using the CssClass property on those tags?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview inside an update panel, that is doing inline editing. When
I have a gridview in update panel and I am doing paging in that,
i'm using an gridview inside the update panel.now in that grid i have 3
I have a gridview inside an update panel.In that gridview, I have a linkbutton
I have a master page that has an update panel on it. One of
I have a gridview with multiple rows, each has a Update button and I
I have a gridview in an update panel and am using a jQuery dialog
I have a gridview in an update panel with the following code to select
I'am building an asp.net application that have a gridview inside an update pannel. In
I have an update panel and a gridview. Within the gridview i have a

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.