Search This Blog

Tuesday, May 8, 2018

SPGridview Pager Style




<SharePoint:SPGridView ID="_gridView" class="table table-striped table-hover" runat="server" AutoGenerateColumns="false" Width="100%">
        <RowStyle BackColor="#D0D8E8" Height="30px" HorizontalAlign="Left" />
        <AlternatingRowStyle BackColor="#E9EDF4" Height="30px" HorizontalAlign="Left" />
        <HeaderStyle HorizontalAlign="Left" CssClass="ms-viewheadertr" />
        <Columns>
            <asp:TemplateField HeaderText="FullName" SortExpression="FullName" HeaderStyle-HorizontalAlign="Left" HeaderStyle-ForeColor="White" HeaderStyle-CssClass="ms-viewheadertr">
                <ItemTemplate>
                    <a title="aTitle" href="#" onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('http://win-2016/_layouts/15/SampleIntranet/popup.aspx?ListId=<%# Eval("ID") %>');return false;"><%# Eval("FullName") %></a>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="lblNoAccess" Text="No data available" runat="server" CssClass="emptyDataLabel"></asp:Label>
        </EmptyDataTemplate>
        <PagerStyle CssClass="pagination-grid" />
    </SharePoint:SPGridView>
<style>
    .pagination-grid {
    /*display: inline-block;*/
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
}

.pagination-grid table > tbody > tr > td {
    display: inline;
}

.pagination-grid table > tbody > tr > td > a,
.pagination-grid table > tbody > tr > td > span {
    position: relative;
    float: left;
    padding: 8px 12px;
    line-height: 1.42857143;
    text-decoration: none;
    color: #dd4814;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    margin-left: -1px;
}

.pagination-grid table > tbody > tr > td > span {
    position: relative;
    float: left;
    padding: 8px 12px;
    line-height: 1.42857143;
    text-decoration: none;   
    margin-left: -1px;
    z-index: 2;
    color: #aea79f;
    background-color: #f5f5f5;
    border-color: #dddddd;
    cursor: default;
}

.pagination-grid table > tbody > tr > td:first-child > a,
.pagination-grid table > tbody > tr > td:first-child > span {
    margin-left: 0;
    border-bottom-left-radius: 4px;
    border-top-left-radius: 4px;
}

.pagination-grid table > tbody > tr > td:last-child > a,
.pagination-grid table > tbody > tr > td:last-child > span {
    border-bottom-right-radius: 4px;
    border-top-right-radius: 4px;
}

.pagination-grid table > tbody > tr > td > a:hover,
.pagination-grid table > tbody > tr > td > span:hover,
.pagination-grid table > tbody > tr > td > a:focus,
.pagination-grid table > tbody > tr > td > span:focus {
    color: #97310e;
    background-color: #eeeeee;
    border-color: #dddddd;
}
</style>

_gridView.PageSize = 30;
 _gridView.AllowPaging = true;

void gvDocuments_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            _gridView.PageIndex = e.NewPageIndex;
            _gridView.DataSourceID = gridDS.ID;
            _gridView.DataBind();
        }



No comments:

Post a Comment