473,563 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ParseControl With Multiple Controls in One Input String

PB
According to the documentation, ParseControl returns a parsed control from
an input string. The documentation seems to assume that *one* control will
be parsed from the string.

My implementation will require an unknown number of controls (always at
least one) to be parsed from the string... after which I inject the
resulting HTML into a PlaceHolder control (see code below).

In my testing, it appears that ParseControl will successfully parse
*multiple* controls from the string (not just one).

My question: Can I safely assume that ParseControl will work fine with
multiple controls in the input string? By "work fine" I mean that (1) it
doesn't matter how many controls are possibly in the input string, and (2)
when I go to rebuild the page during PostBack operations, ParseControl will
parse the controls in the same order every time (assuming the exact same
input string that was originally supplied prior to any PostBack)? I will
need for these controls to maintain VeiwState, so I need to be sure that my
implementation will be reliable.

The following is a sample/model of what I'm doing: The input string contains
an HTML table that has two buttons.

string s = "<table border=2><tr><t d>Yo - this is my
table</td></tr><tr><td><asp :button text='Click here!' runat='server'
/></td></tr><tr><td><asp :button text='No, Click here!' runat='server'
/></td></tr></table>";
System.Web.UI.C ontrol c = ParseControl(s) ;
ContentPlaceHol der.Controls.Ad d(c);

Thanks!
Nov 19 '05 #1
0 1398

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

Similar topics

0
3025
by: Matthias Lohrer | last post by:
Hi, I want to add dynamically controls to my aspx-Page by using the Page.parseControl-method. Page_Load contains this code: str = "<asp:TextBox runat='server' id='txtEingabe' TextMode='SingleLine' /><asp:RequiredFieldValidator id='req' runat='server' ControlToValidate='txtEingabe'>Bitte um eine
1
3390
by: Matthias Lohrer | last post by:
Hi, I'm playing around with the possibilities of Page.ParseControl. I parse a string with an input-field and an RequiredFieldValidator-control. For testing the server-side validation I disable JavaScript and get this scenario: - When you enter a name, no warning appears, that's good! - When you don't enter a name, the warning appears,...
0
1178
by: Chris Simeone | last post by:
Hello, I'm having problems with the ParseControl() method creating unexpected output which I think is preventing events from firing. My code is based on this MSDN article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfsystemwebuitemplatecontrolclassparsecontrolto pic.asp
1
1917
by: Jeremy McPeak | last post by:
Good morning. I am having a problem with the TemplateControl.ParseControl() method. It does parse the string into a control; however, added attributes are left out of the parsing and make it to the final HTML code. For example: ParseControl("<asp:button OnClick="Btn_Click" text='Click here!' runat='server' />"); Becomes this HTML:
2
1482
by: Chris Simeone | last post by:
When I use ParseControl in a C# code behind to create a button... Control c3 = ParseControl("<asp:button id='Button3' text='Btn3' oncommand='OnButton' commandname='Btn' commandargument='b3' runat='server' />"); The HTML that's rendered looks like this... <input type="submit" name="Button3" value="Btn3" id="Button3" oncommand="OnButton"...
1
1635
by: Jeremy McPeak | last post by:
I am playing around with ParseControl(), and I have a question. First here is the code I am using: Control MyButton1 = Page.ParseControl("<asp:button id='MyButton' text='Click here!' runat='server' />"); Form1.Controls.Add(MyButton1); This adds the button to the form; however, I cannot access the button using it's ID (and I have...
1
1761
by: AlanJSmith | last post by:
Hi All, I am using ParseControl to load a formview contol from a string, some of the child controls are bound using Eval but these fail as Eval seems to have already been called within the parse leaving the databind expression blank causing an error to be raised on bind. If i use Bind instead of Eval i get the page back bound properly but...
0
1274
by: Dave | last post by:
Hi, I have a very simple page where i am using Page.ParseControl to create a datagrid control. When i try to run the DataBind method i get various errors. The code for the datagrid is as follows and is fired on OnInit string grid = "<asp:DataGrid ID=\"grid2\" runat=\"server \"><Columns><asp:TemplateColumn><ItemTemplate><asp:LinkButton...
1
1814
by: Jordan S. | last post by:
Using .NET 3.5, I'm wondering how to get a control's specific type (e.g,. "Button" and not simply "Control") after the control is inserted into a control hierarchy - when ParseControl is used. For example, I have the following code: string str = "<table border=1><tr><td>Hello World</td></tr><tr><td><asp:Button ID=\"TestButton\"...
0
7659
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
7580
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...
0
8103
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
7634
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
6244
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
5481
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
5208
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...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
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

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.