Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DropDownList

Reply
Thread Tools

DropDownList

 
 
niju
Guest
Posts: n/a
 
      07-13-2005
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?

 
Reply With Quote
 
 
 
 
niju
Guest
Posts: n/a
 
      07-13-2005
Thanks Eliyah
my code is working fine. I just want the dropdownlist to populate value
in ascending order.

Niju

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-13-2005
There is likely a problem in your code. Check it.

Eliyahu

"niju" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> 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?
>



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      07-13-2005
And the code that populate the list looks like ?
--

Patrice



"niju" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed) oups.com...
> Thanks Eliyah
> my code is working fine. I just want the dropdownlist to populate value
> in ascending order.
>
> Niju
>



 
Reply With Quote
 
niju
Guest
Posts: n/a
 
      07-13-2005
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));

}

}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList inside GridView: How to set SelectedIndex for the DropDownList? keithb ASP .Net 1 11-01-2006 05:24 AM
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments