Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 15th, 2006, 11:32 AM
Registered User
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Dynamic .NET Controls.

Hi ,
I m trying to put dynamic control by below code: but not working.
let us say put 5 dropdown controls. name will be TeamList1,TeamList2, etc.
<% dim i
    for i = 1 to 5%>
    <tr class="TSDeata"><td>
    <asp:DropDownList id="TeamList" & i runat="server"/>


Rupen Anjaria.:)
We CAN'T avoid problems, but can solve it.
Old February 20th, 2006, 06:47 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76

well...i am not sure what is the problem with your code. But i can certainly tell you that this is not the right way of doing this. You dont include asp code here. You can very well do this by asp.net code itself.

Old February 20th, 2006, 04:41 PM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts

Create the controls then use Me.Controls.Add(<control>)


Old February 21st, 2006, 05:30 AM
Registered User
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Is it possible to refer to a user control in the way that rupen wants?

i.e. TeamList1 to be created by id="TeamList" & "1"?

If it is, I would expect the "1" to be a string and not an integer as you have it there, Rupen. Don't think you can do it this way.

Could try id="TeamList" & i.tostring?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Controls with Database. carumuga Classic ASP Professional 0 February 1st, 2007 12:53 AM
Creating Dynamic ASP.NET Server Controls Using XML kwilliams XSLT 0 October 6th, 2006 01:42 PM
Dynamic generation of asp.net server controls shashi1312 Classic ASP XML 1 August 2nd, 2005 04:52 AM
Dynamic generation of controls in ASP.NET Maxood ASP.NET 1.0 and 1.1 Basics 2 March 8th, 2004 07:29 PM
Dynamic Controls tommyuk VB How-To 2 June 26th, 2003 12:54 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.