473,569 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HtmlControl or WebControl from HTML string

Hello,

is it possible to get a HtmlControl from a string including the HTML
code in .NET 2.0? I was using the TemplateControl .ParseControl method
in .NET 1.1, but this is not working in the new version.

CIAO
Michael

Nov 19 '05 #1
4 2833
Your question is confusing. First, what do you mean by "get?" Second, a
Control is a class. A string is text. So, what exactly are youre
requirements?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

<mi************ *@gmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello,

is it possible to get a HtmlControl from a string including the HTML
code in .NET 2.0? I was using the TemplateControl .ParseControl method
in .NET 1.1, but this is not working in the new version.

CIAO
Michael

Nov 19 '05 #2
TemplateControl .ParseControl works fine in 2.0.

Check your syntax :
http://msdn2.microsoft.com/en-us/lib...l.parsecontrol

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
<mi************ *@gmail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello,

is it possible to get a HtmlControl from a string including the HTML
code in .NET 2.0? I was using the TemplateControl .ParseControl method
in .NET 1.1, but this is not working in the new version.

CIAO
Michael

Nov 19 '05 #3
The problem is that I need this feature in a library, not on a page. I
get the error ArgumentExcepti on for argument virtualPath.

CIAO
Michael

Nov 19 '05 #4
"Kevin Spencer" wrote:
Your question is confusing. First, what do you mean by "get?" Second, a
Control is a class. A string is text. So, what exactly are youre
requirements ?

I get a string like "<select><optio n value=1>One</option></select>" and
want to get a HtmlSelect control. In .NET 1.1 I used this code:
TemplateControl p = new System.Web.UI.U serControl();
Control htmlControl = p.ParseControl( "<select
runat=\"server\ "><option>h ans</option></select>");

HtmlControl result = null;

if (htmlControl.Ge tType() == htmlControlType )
{
result = htmlControl as HtmlControl;
}
else
{
foreach (Control con in htmlControl.Con trols)
{
if (con.GetType() == htmlControlType )
{
result = con as HtmlControl;
break;
}
}
}
In .NET 2.0 I get an exception that the property virtualPath is missing.
If I use the ParseControl method in a webform (UI.Page) it is working
correct, but I need this code in a library.

Regards,
Michael



--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

<mi*********** **@gmail.com> wrote in message
news:11******* *************** @g47g2000cwa.go oglegroups.com. ..
Hello,

is it possible to get a HtmlControl from a string including the HTML
code in .NET 2.0? I was using the TemplateControl .ParseControl method
in .NET 1.1, but this is not working in the new version.

CIAO
Michael



--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 19 '05 #5

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

Similar topics

1
6017
by: anthonysmales | last post by:
I have a webservice which implements a webmethod called PrettyXML. This webmethod loads an XML file and returns the XML, which is then displayed in a webcontrol (textbox) on a webform. If no XML file is found, it just returns null atm. I would now like to alter it so that if the XML file is not found, some HTML is sent to the webcontrol...
0
1379
by: Hutch | last post by:
I am looking for some thoughts on this. I have successfully gotten the HTMLControl to work using C#, and it is displaying HTML and receiving messages nicely. Unfortunately, I am not able to receive notifications from the HTMLControl. In an attempt to support this, I added a private MessageWindow derived class to the control,...
1
1869
by: Victor | last post by:
Hi I read an article on MSDN called "Deciding When to Use the DataGrid, DataList or Repeater". It describes and compares the three web controls from the usability and performance stand point. The idea of the article is that DataGrid is the easiest to use, but has the worse performance and the Repeater web control is exactly the opposite My...
0
1585
by: Lucas, Todd | last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing for a Menu. I've been at it for about 3 weeks now, and can't seem to get around this problem. So I'm hoping that someone can help me ... My environment: VS 2003 v7.1.3088, Win2K v5.0.2195 SP3, IE6 v6.0.2800.1106 browser. I have a class (C3Menu) derived from...
0
2938
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it such as when they do a delete. Everything is great. By and large it will be used in my repeater controls using the command event when the user...
0
2015
by: Dariusz Tomon | last post by:
Hi I have got the problem with web control displaying flash (swf) object. The problem is connected with the fact that 1-st swf should loads the second one. But it doesn't. That's why I suspects taht webcontrol or class under it causes that problem. Maybe the following code is too long to analyze so pls redirect me whare I could...
1
2576
by: CharlesA | last post by:
Hi folks I want to add a <ul> list with some <li> items in .net code behind on the fly I was under the impression that you could instantiate any HTML control by using the HTMLControl class with constructor parameters like so HTMLControl("ul") the purpose being that I could then program some of the attributes of the ul
5
1580
by: zino | last post by:
my asp.net page need to display links (<a></a>) as tabs. I create a class that inherits from HtmlAnchor as: Public Class Tab Inherits System.Web.UI.HtmlControls.HtmlAnchor '(inheriting from HtmlControl is good or bad ????) Private _Id As String = "myId"
0
1146
by: JohnK82 | last post by:
Hi guys I have a webcontrol that displays an article in multiple parts. You can jump back and forward between the parts (I call them sheets) by clicking on a label. Each sheet has a label. The control is used like this: <john:MyControl runat="server"> <john:Sheet label="Intro"> This is the first part of the text... </john:Sheet>
0
7697
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...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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...
0
6283
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...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
0
937
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...

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.