Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Repeater And Dropdown List

Posted on 2013-05-31
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 13

Accepted Solution

Jitendra Patil earned 1000 total points
ID: 39212544
try this from the link given below.
Custom paging in Repeater control in asp.net(C#, VB)

hope this helps.

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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