Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 December 6th, 2006, 04:56 AM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Web Control

Hi,

I want to create a dynamic web server control in ASP.net.I have a name of all control in drop downlist.Now i want to create a control on a dropdown select event.
Like this:

 string ddlSelectedValue = DropDownList1.SelectedItem.Text;
        Control controlDynamic =new Control();
        controlDynamic =controlDynamic.FindControl(ddlSelectedValue);

         form1.Controls.Add(controlDynamic);

But it not working giving error:

Value cannot be null.
Parameter name: child

Can any one plzz help me?


 
Old December 6th, 2006, 09:15 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Heuh? What are you trying to accomplish?

When you create an instance of Control, all you get is a brand new control. What makes you think its Controls collection (that you access with FindControl) contains *another* control that can be found by its ID?

Can you explain in more detail what it is you're trying to do?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic button control SKhna ASP.NET 2.0 Basics 1 February 1st, 2008 10:36 AM
set Focus to web control in Web form vivekshah C# 1 June 17th, 2006 03:25 AM
Add Dynamic Control HELP HELP jimmyfrank Access VBA 1 January 26th, 2005 06:05 PM
Dynamic control part 2 Warbird General .NET 0 July 12th, 2004 08:50 AM
Dynamic placing of a control Warbird General .NET 1 July 9th, 2004 02:19 PM





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