Repeater And Dropdown List

Posted on 2013-05-31
Last Modified: 2013-06-04
Dear Gurus,
I want to put paging datas to a dropdown list.
But I can't.
This is my sexy code behind:
        private void LoadData()
            SqlDataAdapter da = new SqlDataAdapter("Select Top 50 Title From tbl_Title Order By TID Desc", myFunction.GetConnections.NormalSqlConnect());
            DataTable dt = new DataTable();
            PagedDataSource pgitems = new PagedDataSource();
            DataView dv = new DataView(dt);
            pgitems.DataSource = dv;
            pgitems.AllowPaging = true;
            pgitems.PageSize = 10;
            pgitems.CurrentPageIndex = PageNumber;
            if (pgitems.PageCount > 1)
                rptPages.Visible = true;
                ArrayList pages = new ArrayList();
                for (int i = 0; i < pgitems.PageCount; i++)
                    pages.Add((i + 1).ToString());
                rptPages.DataSource = pages;
                rptPages.Visible = false;
            rptItems.DataSource = pgitems;
        void rptPages_ItemCommand(object source, RepeaterCommandEventArgs e)
            PageNumber = Convert.ToInt32(e.CommandArgument) - 1;

        private int PageNumber
                if (ViewState["PageNumber"] != null)
                    return Convert.ToInt32(ViewState["PageNumber"]);
                    return 0;
                ViewState["PageNumber"] = value;
        protected override void OnInit(EventArgs e)
            rptPages.ItemCommand +=
               new RepeaterCommandEventHandler(rptPages_ItemCommand);

Open in new window

This is front page:
      <asp:Repeater ID="rptPages" Runat="server">
         <asp:LinkButton ID="btnPage"
                         Container.DataItem %>"
                         Runat="server"><%# Container.DataItem %>
      <asp:Repeater ID="rptItems" runat="server">
          <li><a href="<%#myFunction.clearLink(Eval("Title").ToString()) %>"><span class="small3parmakicon"><%#Eval("Title") %></a></span></li>

Open in new window

Could you give an example?
Question by:fancyfanta
1 Comment
LVL 12

Accepted Solution

jitendra patil earned 500 total points
ID: 39212544
try this from the link given below.
Custom paging in Repeater control in, VB)

hope this helps.

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now