DropDownList

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • niju

    DropDownList

    Hi
    I have a dropdownlist which consists of numeric values that represent
    5-minute intervals which are displayed in ascending order
    i.e. 00
    05
    10
    15
    20
    25
    30
    35
    40
    45
    50
    55

    When the page is loaded, a default value is selected based on the
    current time. However, when this default value is selected, it alters
    the order of all the other values on the dropdownlist, and the default
    value itself becomes the first value in the dropdownlist.
    e.g. 25
    30
    35
    40
    45
    50
    55
    00
    05
    10
    15
    20
    How do I keep the exact order of these values?

  • Eliyahu Goldin

    #2
    Re: DropDownList

    There is likely a problem in your code. Check it.

    Eliyahu

    "niju" <dipendra.neupa ne@gmail.com> wrote in message
    news:1121238030 .057157.28440@o 13g2000cwo.goog legroups.com...[color=blue]
    > Hi
    > I have a dropdownlist which consists of numeric values that represent
    > 5-minute intervals which are displayed in ascending order
    > i.e. 00
    > 05
    > 10
    > 15
    > 20
    > 25
    > 30
    > 35
    > 40
    > 45
    > 50
    > 55
    >
    > When the page is loaded, a default value is selected based on the
    > current time. However, when this default value is selected, it alters
    > the order of all the other values on the dropdownlist, and the default
    > value itself becomes the first value in the dropdownlist.
    > e.g. 25
    > 30
    > 35
    > 40
    > 45
    > 50
    > 55
    > 00
    > 05
    > 10
    > 15
    > 20
    > How do I keep the exact order of these values?
    >[/color]


    Comment

    • niju

      #3
      Re: DropDownList

      Thanks Eliyah
      my code is working fine. I just want the dropdownlist to populate value
      in ascending order.

      Niju

      Comment

      • Patrice

        #4
        Re: DropDownList

        And the code that populate the list looks like ?
        --

        Patrice



        "niju" <dipendra.neupa ne@gmail.com> a écrit dans le message de
        news:1121245306 .445688.206890@ o13g2000cwo.goo glegroups.com.. .[color=blue]
        > Thanks Eliyah
        > my code is working fine. I just want the dropdownlist to populate value
        > in ascending order.
        >
        > Niju
        >[/color]


        Comment

        • niju

          #5
          Re: DropDownList

          Here is the code

          private void getMinute()
          {
          DateTime dateTime = DateTime.Now;
          string strHourMin,lstI tem,strMin =null;

          string[] values;
          char[]delimiters = {':',' '};

          strHourMin = dateTime.ToStri ng("t");
          values = strHourMin.Spli t(delimiters);

          int minute = System.Convert. ToInt32(values[1]);
          int tempMinute = 0;
          string strTempMin = null;




          string strRightDigit = values[1].Substring(1,1) ;
          string strLeftDigit = values[1].Substring(0,1) ;

          int intRightDigit = System.Convert. ToInt32(strRigh tDigit);
          int intLeftDigit = System.Convert. ToInt32(strLeft Digit);

          if (intRightDigit <5)
          {
          strTempMin = intLeftDigit.To String() + "5";
          }
          else
          {
          tempMinute = intLeftDigit + 1;
          strTempMin = tempMinute.ToSt ring() + "0";
          }
          int intMinute = System.Convert. ToInt32(strTemp Min);
          strMin = intMinute.ToStr ing("00");

          for (int i =0;i<11;i++)
          {
          intMinute = (intMinute + 5);
          if (intMinute > 55)
          {intMinute =0;}
          lstItem = intMinute.ToStr ing("00");

          sltMinute.Items .Insert(i,new ListItem(lstIte m));

          }

          }

          Comment

          Working...