Jump to content
  • Advertisement
Sign in to follow this  
kappa

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

This topic is 4616 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!