Sign in to follow this  

[.net] Why won't my gridview turn the page?

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is most likely some simple mistake I've made but from my position it's just plain wierd. I have several gridviews in my project all of them are working fine and I never had a problem that is untill I created my last page, were everytime everytime I change page index my controll just does not render. Here is the culprit btw:
[source[
<asp:GridView ID="searchHits" AutoGenerateColumns="false" runat="server" 
AllowPaging="True" CellPadding="5" ForeColor="#333333" GridLines="None"
Width="100%" OnPageIndexChanging="searchHits_PageIndexChanging">

            <Columns>
            <asp:TemplateField>
            <ItemTemplate>
            <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="trash.png" />
            </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Kompositör">
                <ItemTemplate>
                    <%# Eval("KOMPOSITÖR")%> 
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="CD titel">
                <ItemTemplate>
                    <%# Eval("CD TITEL")%> 
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Artist">
                <ItemTemplate>
                    <%# Eval("ARTIST")%>  
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Art. nummer">
                <ItemTemplate>
                    <%# Eval("ARTNUMMER")%>  
                </ItemTemplate>
            </asp:TemplateField>
            
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" Font-Size="XX-Small" Wrap="True" />
            <EditRowStyle BackColor="#2461BF" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>



 protected void searchHits_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        searchHits.PageIndex = e.NewPageIndex;
        searchHits.DataBind();
    }



Does anyone see where the problem could lie?

Share this post


Link to post
Share on other sites
what does your PageLoad() function look like? Often people re-intialize the control when they shouldn't. Make sure you are checking IsPostBack

Share this post


Link to post
Share on other sites

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this