Paging a DataList using

I have a web page where I would like to display data tiled horizontally.  The problem is that my data will have over 3,000 records.  If I use the DataList data control, it does not allow for paging.  

Is there a way to convert my code listed below into some sort of pageable DataList?  Thanks in advance!
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
        SelectCommand="SELECT * FROM Project WHERE (Orderable = '1')>
    </asp:SqlDataSource>
    <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" Width="100%"
        RepeatColumns="4" RepeatDirection="Horizontal" CellPadding="2" CellSpacing="2">
        <ItemTemplate>
            <itemtemplate>
                    <asp:Image ID="Image2" runat="server" Width="125px" ImageUrl='<%# Eval("ID", "ImageLoader.ashx?id={0}") %>' />
                    <br />
                    <%# DataBinder.Eval(Container.DataItem, "Name")%>
                    <br /><br />
                    Amount:&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem, "Amount")%>
                </itemtemplate>
        </ItemTemplate>
        <ItemStyle Font-Size="10px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
    </asp:DataList>

Open in new window

delousedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jinn_hnnlCommented:
Yes DataList has no paging mechanism. You gotta make it your own, there are several ways. But the best way you can do is Binding your Datalist datasource dynamically.

http://forums.asp.net/t/1319544.aspx

You can use SqlDataAdapter, the SqlDataAdapter allow you to select and get data upon start and number of record you want to return. Try to remember the page number using ViewState and using when you fill the dataSet

Hope this helps

JINN






public DataTable getTheData()
    {
 
        DataSet DS = new DataSet();
        SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyProject"].ConnectionString);
 
        SqlDataAdapter objSQLAdapter = new SqlDataAdapter("SELECT * FROM Project WHERE (Orderable = '1'", myConnection); objSQLAdapter.Fill(DS, "Projects");
 
 
        return DS.Tables[0];
 
    }
 
    void doPaging()
    {
 
        pagedData.DataSource = getTheData().DefaultView;
 
        pagedData.AllowPaging = true;
        pagedData.PageSize = 4;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
delousedAuthor Commented:
Awesome. That was exactly what I was looking for.  
0
jinn_hnnlCommented:
Cool,

I am glad to help ^^

JINN
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.