我在更新面板中有一個GridView。更新面板中的Gridview在頁面更改中丟失備用行着色
GridView的樣式使每個備用行都是不同的顏色。
當我在GridView上更改頁面時,它會丟失備用行着色。所有其他風格都保持不變。
如果我刪除更新面板,GridView會在更改頁面後保持備用行着色。
有沒有人有任何想法可能會導致此問題或如何解決它?
感謝, 尼爾
編輯:
下面是ASPX代碼
<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>
這是該功能時的頁面變化發生時調用:
protected void gvActiveLogbooks_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
HideShowGridViewPagerLinks(e.NewPageIndex);
gvActiveLogbooks.DataSource = _logbooks;
gvActiveLogbooks.PageIndex = e.NewPageIndex;
gvActiveLogbooks.DataBind();
}
在頁面上沒有任何地方可以用G着色ridView行
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();
}
你在使用ScriptManager嗎? –
您的GridView是否真的帶有一些css樣式的**樣式,或者您是否使用一些代碼繪製它? –
是的頁面上有ScriptManager標籤。相當肯定這是它的樣式的CSS代碼。我將發佈上面的代碼。 – Neil