473,796 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generate web controls programitically

This is basically repost of my previous (unanswered) question.
What I try to do is to generate Web controls on the Page surface during
design time from withing my own component; they do appear in the code behind
but not on the surface of Designer. Moreover, they DO exist in
container.Compo nents collection.

May be someone knows (at least) how to make a control to generate it's own
html design time code (this <of type <asp:...>, not HTML rendering...)?

<repost starts here>

I try to add a textbox from code of my custom component laid on the web form.
It appears in the code behind but not in the designer; moreover when I switch
from design to html view it gets removed from the code-behind.
What interesting: when (by mistake) I tried to add Windows TextBox the code
added it to the component section of the designer (so "almost" desired
behaviour...)
Any ideas, please?

The code is based on MSDN example of component
ms-help://MS.VSCC.2003/MS.MSDNQTR.2004 OCT.1033/cpref/html/frlrfSystemComp onentModelDesig nIDesignerHostC lassTopic.htm
- I'm trying this code when user double-clicks component

IDesignerHost host =
(IDesignerHost) this.component. Site.GetService (typeof(IDesign erHost));
IComponent newItem =
host.CreateComp onent(typeof(Sy stem.Web.UI.Web Controls.TextBo x), "txtNew");
//when this code used, works
//IComponent newItem =
host.CreateComp onent(typeof(Sy stem.Windows.Fo rms.TextBox), "txtNew");

Nov 18 '05 #1
0 948

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2376
by: Stephen Tang | last post by:
Hi, I'm relatively new at this language, so I've been trying to find parallels to problems I've run into in the past. This is the hypothetical problem: I want to write a CD inventory application. There is a page where it asks the user for the number of tracks on a CD. After they enter the number of tracks, I would like to generate that number of text fields on the page (i.e. if user enters 30, I want to generate 30 text fields), so...
4
2562
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I can use comma separated values in design-time. The TypeConverter works great in design-time. It converts to and from just fine... However, when I try to load any page in the site now I get the following error (Following the error is code for the...
3
1941
by: Dennis M | last post by:
Hey everyone, I am curious what the performance impact of a custom control would be if it had a significant hierarchy of children. For example, 40 child controls, 5 levels deep, each control on average has 20 properties. What would be the best way to implement such a thing? The book I am reading uses templated controls and basically reconstructs the entire hierarchy everytime page is accessed based on the tags in the .aspx file, but...
5
1915
by: sambuela | last post by:
All data controls and wizards about dataset, adapter or dataviewer disappear in the IDE. How can i let them appear again? It is because i want to generate dataset by these wizard. Thanks in advance. ps. After i try to use previous generated adapter, i still can't generate new dataset for it.
4
1884
by: WB | last post by:
Hi, How can I generate web controls such as textboxes and drop-menus on the fly? My web application allows users to fill out PDF forms online. There are many PDF forms, and my application reads the fields in the user's chosen PDF file, displays a webform with relevant fields (textbox or drop-menu or radio buttons etc) for user to fill out online. I'm using a 3rd party software to read and write to the PDF file, but I don't know how to...
0
3420
by: Avon | last post by:
Hi friends, I am very sorry for my not perfect English. I have one question, I am using David Bauer's DynamicControlsPlaceholder to dinamically generate controls and I am tryig to generate MultiViev, at first it working, when I click btn1 I set SetActiveView to viev1 and it's working OK, but when after that I click btn2 and try to set SetActiveView to 2, I receive this error:
1
3451
by: Scott Zabolotzky | last post by:
I'm sure somebody has to have done this already but I can't find any good references. If I have an XML file with an associated XSD what is the best way to dynamically generate a web form with proper controls for the various elements in the XML file? I found an article that describes how to do it using stylesheets (http://www.dnzone.com/ShowDetail.asp?NewsId=151) but it's a little cumbersome and was tailored to .NET 1.1.
5
1362
by: sean.gilbertson | last post by:
Hi, I'm sort of new to ASP.NET 2.0 and ASP.NET in general. I have some data that I would like to display in a tabular format, but I'm going to be generating the columns dynamically, and I would like to make it so that each row can be expanded downward dynamically to show detailed information. So far, it seems like I'll have to use an asp:Table and generate the entire thing in code -- including the Javascript to hide and show the
2
1851
by: | last post by:
Hi, I have 2 scenarios: First, an aspx page that contains 300 controls with the labels of course in a table. Second, an empty aspx page that contains on loading a script that creates the 300 controls dynamically. On every open of the page for reading, the system will fetch data from SQL and draw the 300 labels with the corresponding data and On every edit of the
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.