DropDownList

Discussion in 'ASP .Net' started by niju, Jul 13, 2005.

  1. niju

    niju Guest

    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?
     
    niju, Jul 13, 2005
    #1
    1. Advertising

  2. niju

    niju Guest

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

    Niju
     
    niju, Jul 13, 2005
    #2
    1. Advertising

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

    Eliyahu

    "niju" <> wrote in message
    news:...
    > 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, Jul 13, 2005
    #3
  4. niju

    Patrice Guest

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

    Patrice



    "niju" <> a écrit dans le message de
    news:...
    > Thanks Eliyah
    > my code is working fine. I just want the dropdownlist to populate value
    > in ascending order.
    >
    > Niju
    >
     
    Patrice, Jul 13, 2005
    #4
  5. niju

    niju Guest

    Here is the code

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

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

    strHourMin = dateTime.ToString("t");
    values = strHourMin.Split(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(strRightDigit);
    int intLeftDigit = System.Convert.ToInt32(strLeftDigit);

    if (intRightDigit <5)
    {
    strTempMin = intLeftDigit.ToString() + "5";
    }
    else
    {
    tempMinute = intLeftDigit + 1;
    strTempMin = tempMinute.ToString() + "0";
    }
    int intMinute = System.Convert.ToInt32(strTempMin);
    strMin = intMinute.ToString("00");

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

    sltMinute.Items.Insert(i,new ListItem(lstItem));

    }

    }
     
    niju, Jul 14, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mr2_93
    Replies:
    1
    Views:
    3,645
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,253
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,888
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,323
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    12,131
    shauns1
    Nov 1, 2006
Loading...

Share This Page