Click here to Skip to main content
15,892,927 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to use an Xml file as a database? Pin
Christian Graus26-Mar-07 17:46
protectorChristian Graus26-Mar-07 17:46 
GeneralDateTime Pin
bernie_01126-Mar-07 19:18
bernie_01126-Mar-07 19:18 
QuestionBi/multi lingual site Pin
Glenn E. Lanier II26-Mar-07 11:09
Glenn E. Lanier II26-Mar-07 11:09 
AnswerRe: Bi/multi lingual site Pin
Mark Greenwood26-Mar-07 13:47
Mark Greenwood26-Mar-07 13:47 
GeneralRe: Bi/multi lingual site Pin
Glenn E. Lanier II28-Mar-07 3:34
Glenn E. Lanier II28-Mar-07 3:34 
QuestionRe: Bi/multi lingual site Pin
Glenn E. Lanier II25-Apr-07 9:43
Glenn E. Lanier II25-Apr-07 9:43 
QuestionUpdate to control walking issue Pin
Glenn E. Lanier II25-Apr-07 10:09
Glenn E. Lanier II25-Apr-07 10:09 
Question!!!Question about Programmatically adding items to list control Pin
vicky45726-Mar-07 9:55
vicky45726-Mar-07 9:55 
I need to fill a dropdownlist with 1 to 60. So I did it by doing the following code:

for(int i=0; i <=60; i++)
DropdownList1.Items.Add(new ListItem(i.ToString(), i.ToString()))

However, I was thinking this probally is not good idea to use "new ListItem" each time. So I replace the above with the following:

ListItem li = new ListItem();
for(int i=0; i <=60; i++)
{
li.Text = i.ToString();
li.Value = i.ToString();
DropdownList1.Items.Add(li)
}
But the result turned to be all the items in the list are 60. Is there anything in the second code wrong? I have seen people using the first code all the time, but bot the second code. Does anybody know why? Could anybody give me some ideas why the second code doesn't work?

What's the life cycle of the new item when using
DropdownList1.Items.Add(new ListItem(i.ToString(), i.ToString()))

The last IMPORTANT question is: Does using "new listitem" will cause performance issue, such as more memory allocation, etc?

I would really appreciate any ideas!

Thank you in advance!
AnswerRe: !!!Question about Programmatically adding items to list control Pin
error140826-Mar-07 10:10
error140826-Mar-07 10:10 
GeneralRe: !!!Question about Programmatically adding items to list control Pin
vicky45726-Mar-07 11:14
vicky45726-Mar-07 11:14 
AnswerRe: !!!Question about Programmatically adding items to list control Pin
Christian Graus26-Mar-07 14:07
protectorChristian Graus26-Mar-07 14:07 
Questionexport data to excel creating multiple worksheets Pin
bonokoot26-Mar-07 9:39
bonokoot26-Mar-07 9:39 
QuestionNot able to view Web Application Project Pin
duaatul26-Mar-07 8:30
duaatul26-Mar-07 8:30 
AnswerRe: Not able to view Web Application Project Pin
ToddHileHoffer26-Mar-07 8:43
ToddHileHoffer26-Mar-07 8:43 
GeneralRe: Not able to view Web Application Project Pin
duaatul26-Mar-07 9:28
duaatul26-Mar-07 9:28 
QuestionTutorial for GridViews ? Pin
digsy_26-Mar-07 7:57
digsy_26-Mar-07 7:57 
AnswerRe: Tutorial for GridViews ? Pin
ToddHileHoffer26-Mar-07 8:26
ToddHileHoffer26-Mar-07 8:26 
GeneralRe: Tutorial for GridViews ? Pin
digsy_26-Mar-07 8:51
digsy_26-Mar-07 8:51 
AnswerRe: Tutorial for GridViews ? Pin
error140826-Mar-07 10:22
error140826-Mar-07 10:22 
QuestionHow to access a treeview control from another .aspx file Pin
r_jaz26-Mar-07 7:56
r_jaz26-Mar-07 7:56 
AnswerRe: How to access a treeview control from another .aspx file Pin
varshavmane26-Mar-07 22:22
varshavmane26-Mar-07 22:22 
QuestionUsing GridView and In Memory Data Stores Pin
Stephen Adam26-Mar-07 7:12
Stephen Adam26-Mar-07 7:12 
AnswerRe: Using GridView and In Memory Data Stores Pin
ToddHileHoffer26-Mar-07 7:34
ToddHileHoffer26-Mar-07 7:34 
QuestionPlease Help Me Soon Pin
Mkanchha26-Mar-07 6:01
Mkanchha26-Mar-07 6:01 
AnswerRe: Please Help Me Soon Pin
Naveed Kamboh26-Mar-07 6:15
Naveed Kamboh26-Mar-07 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.