Paging in the Photo Section RRS feed

  • Question

  • User744926042 posted

    I have created multiple albums and the paging doesn't seem to work...I would like to only have 6 albums and the rest on the next page. 





    Thursday, February 22, 2007 3:29 PM

All replies

  • User-1055590327 posted

    I have had success doing this. 
    What you have to do is copy the <ItemTemplate> content from the existing datalist then delete the datalist and create a gridview and then paste the code into that.  In fact, i'm working on a realtor web site not only adding paging, but dynamic sorting based on a variety of dropdowns.  For your goal, try this---


    1. From the existing listview, copy <ItemTemplate> .....original photoalbum code here........</ItemTemplate>
    2. Delete the listview
    3. Create a new datagrid
    4. In the new gridview you'll need to add     <asp:TemplateField>   </asp:TemplateField>
    5. Paste  <ItemTemplate> .....original photoalbum code here........</ItemTemplate>  inside the <asp:TemplateField> tags.  Should look like something like this (configured to your datasource of course):

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="albumid" DataSourceID="ObjectDataSource1" AllowSorting="True" PageSize="6">



                   <ItemTemplate> original photoalbum code listview here</ItemTemplate>



    <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="3" Position="TopAndBottom" />

     I can't remember if this was the page i had to jack with the sproc or not, it's late, that's all i got. 

    Sunday, March 11, 2007 1:06 AM
  • User-1055590327 posted
    Correction to above -  

    2. Delete the Datalist

    3. Create a new Gridview


    sorry, really tired...

    Sunday, March 11, 2007 1:10 AM
  • User-1896373168 posted

    I get errors with this can you help with it..

     I copied the content from my DataList and then deleted it.

    I then added a GridView and posted this in the code

    <asp:GridView ID="GridView1" runat="server" Height="364px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"




    <asp:ImageButton ID="ImageButton1" ImageUrl='<%# "imagefetch.ashx?size=1&imageid=" & Cstr(Eval("id")) %>'

    runat="server" CommandName="select" /><br />

    <asp:Label Text='<%# Eval("title") %>' runat="server" ID="titleLabel" />






    the first time i did it i did not have the <columns> tag and  when i  changed to the design view it gave me the following error

    Error Creating Control-content 1

    Type 'System.Web.UI.WebControls.'GridView'does not have a public property named 'Item Template'\

    I then added the columns tag and it would not let me go to the design view and left the following error

    never mind that error there was just an error i did something else I remove your code and configured my datasource

    I ran my website to a browser and i was able to enter my site  but when i went into the photo album of choice i got the following error

    Server Error in '/ClubWebSite1' Application.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30451: Name 'DataList2' is not declared.

    Source Error:

    Line 15: 
    Line 16:     Protected Sub FormView2_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Line 17:         DataList2.SelectedIndex = FormView2.PageIndex
    Line 18:         FormView1.ChangeMode(FormViewMode.ReadOnly)
    Line 19:     End Sub

    now what do i do. keep in mind while configuring my data source it was showing me my photo when i hit test query in the configure data source section of the gridview section


    Thursday, February 26, 2009 6:28 PM