Naming randomly a DropDownList
-
Hi, I need help for a stupid question.. I want to cicle this: DropDownList s = new DropDownList(); And so i can't use the same name for more than one DDL.. I thought to use this: Random i= new Random(); string s = i.ToString(); DropDownList s = new DropDownList(); but obviously it all ends in an error cause s was assigned before as string... Suggestions?? :sigh:
-
Hi, I need help for a stupid question.. I want to cicle this: DropDownList s = new DropDownList(); And so i can't use the same name for more than one DDL.. I thought to use this: Random i= new Random(); string s = i.ToString(); DropDownList s = new DropDownList(); but obviously it all ends in an error cause s was assigned before as string... Suggestions?? :sigh:
What you ae thinking is to dinamically create s ? That is a wrong way if you want to create dynamic dropdownlist. It is not the s(That is just a pointer to the newly created object) but id that diffrentiates the dropdownlist in the runtime so give them dinamic id's Eg: Random i= new Random(); DropDownList s = new DropDownList(); s.Id = i.ToString(); How about that.
Thanks Laddie Kindly rate if the answer was helpful
modified on Monday, March 31, 2008 6:09 AM
-
What you ae thinking is to dinamically create s ? That is a wrong way if you want to create dynamic dropdownlist. It is not the s(That is just a pointer to the newly created object) but id that diffrentiates the dropdownlist in the runtime so give them dinamic id's Eg: Random i= new Random(); DropDownList s = new DropDownList(); s.Id = i.ToString(); How about that.
Thanks Laddie Kindly rate if the answer was helpful
modified on Monday, March 31, 2008 6:09 AM