I have a code where I need to Hide certain Rows based on a condition. The Gridview is binded through Custom Paging with a Stored Procedure.
Problem right now is that, I have set to display 100 records per page in the gridview. Example in the first page, 10 Rows have to be hidden based on a condition, so the first page only has 90 records. It should be 100 records.
How do i bring data from the second page to the first page?
Fyi, i have been searching this solution for almost 2 days but no real solution have been founded.
ASPX Code, I take only a field from my actual code
<asp:GridView ID="GridView3" CssClass="footable" data-sort="false" runat="server" Width="100%" AlternatingRowStyle="align:top;"
AutoGenerateColumns="False"
HorizontalAlign="Center" EmptyDataText="<%$Resources:chienvh.language, xNoData%>"
GridLines="Both" AllowPaging="false" OnRowDataBound="GridView3_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="<%$Resources:chienvh.language, xStaffID%>" ItemStyle-VerticalAlign="Middle" ItemStyle-Width="8%">
<ItemTemplate>
<div>
<asp:Label ID="lblStaffNo2" runat="server" Text='<%# Eval("StaffNo")%>' CssClass="upper-case" />
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</GridView>
Code Behind:
protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (somecondition)
{
e.Row.Visible = false;
}
}
}
Any help would be appreciated