Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 6th, 2006, 04:56 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
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?


  #2 (permalink)  
Old December 6th, 2006, 09:15 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:56 AM.


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