Click here to Skip to main content
15,890,408 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii,

C#
private void BusinessYearMonthAndDateDropDown()
       {
           DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(null);

           for (int i = 1; i < 13; i++)
           {
               drpBusinessStartMonth.Items.Add(new ListItem(info.GetMonthName(i), i.ToString()));

           }

           for (int i = 1; i <= 31; i++)
           {
               drpBusinessStartDate.Items.Add(i.ToString());
           }
       }



This is my code.. does this code stores datavalue field property . if i am adding moths into my list .. can i get its value property as 1 to 12 as well .. if not how can i set that in my code?
Posted
Comments
Mahesh Bailwal 30-Aug-13 7:39am    
yes you can. below is sytnax

drpBusinessStartMonth.Items[itemIndex].Value;

1 solution

Yes your code is setting the value of the listitem as well. Visit the following link for details about what you are actually doing: http://msdn.microsoft.com/en-us/library/7f7h2h8h.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900