.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 13th, 2005, 07:38 PM
niju niju is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 4 niju User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 51 sec
Reputation Power: 0
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?

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(strRigh*tDigit);
int intLeftDigit = System.Convert.ToInt32(strLeft*Digit);


if (intRightDigit <5)
{
strTempMin = intLeftDigit.ToString() + "5";
}
else
{
tempMinute = intLeftDigit + 1;
strTempMin = tempMinute.ToString() + "0";
}
int intMinute = System.Convert.ToInt32(strTemp*Min);
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));


}


}



Many Thanks
Niju

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Dropdownlist


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT