how to loop through a list to datetime pickers ?

Posted on 2009-12-28
Last Modified: 2012-06-27
hello i am having 12 datetime pickers in a form (AppDate1,AppDate2...)
. I am trying to get their values like this

          RadDateTimePicker Date = new RadDateTimePicker();
          Date.ID = "AppDate" + i.ToString();
          values.text + = values.text + Date.SelectedDate.Value.ToString();
 this is not working ?
Question by:kreddy01
    LVL 58

    Accepted Solution

    You are creating a new RadDateTimePicker at runtime. They have no association with the one that you have on the page. You have not shown the aspx side but the code should be something like this

              RadDateTimePicker Date;
              Date = (RadDateTimePicker) Page.FindControl("AppDate" + i.ToString());
              //Make sure Date is not null here
              values.text + = values.text + Date.SelectedDate.Value.ToString();

    Page.FindControl could be something different if your date pickers are not directly in the page.

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
    If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
    Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
    Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now