Questions tagged [parsecontrol]

ParseControl is an ASP.NET function that parses an input string to create an ASP.NET server control object.

ParseControl is an ASP.NET function that parses an input string to create a server control object.

It was introduced in .NET 3.5, and is a public method of the TemplateControl class, which both Page and UserControl inherit from.

Reference on MSDN:

9 questions
3
votes
5 answers

Workaround for ParseControl not supporting inline code blocks?

I'm using the ParseControl method in ASP.Net to render some mixed HTML and server control code which is coming from an external data source. This is working well, however ParseControl does not seem to support inline script blocks (<% %>), and I'm…
TimS
  • 5,922
  • 6
  • 35
  • 55
1
vote
1 answer

Why does Page.ParseControl not create control inherited from the correct base class?

I dynamically create a User Control from XML via XSLT. Output is a string with a content like this: <%@ Control Language="C#" AutoEventWireup="true" Inherits="Library.Web.UI.GeneratedFormBase, MyAssembly" %>
Sebastian P.R. Gingter
  • 5,955
  • 3
  • 31
  • 73
1
vote
1 answer

Is there an alternative for Page.ParseControl in ASP.NET?

I have written a class library function that parses a string to a control. It takes the current page and uses page.ParseControl to parse the string as a control. System.Web.UI.Page page = (System.Web.UI.Page)…
Andre
  • 1,852
  • 1
  • 16
  • 21
1
vote
0 answers

ASP.net ParseControl if else statement

Hope someone help me with this. Is this possible in asp.net? protected void Page_Load(object sender, EventArgs e) { Control parsed = this.ParseControl(@"<% if (true){ %>
Show True Content
<%}…
suangetss
  • 21
  • 4
0
votes
2 answers

Does ParseControl do any caching?

We use Page.ParseControl to interpret a string of XML into controls. Does it use some kind of caching mechanism? If not - is there a way to cache its result? Page.LoadControl seems to support some sort of caching.
Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
0
votes
1 answer

Problem with events and ParseControl

I'm adding a control (linkbutton) dynamically using ParseControl and it's fine except when I specify an event handler. If I use: Dim c As Control = ParseControl("
Richard Edwards
  • 1,379
  • 1
  • 17
  • 30
0
votes
1 answer

ParseControl in Dotnetnuke ASP.NET changing onclick to javascript instead of c# method provided, strange behavior

Having some strange behavior here. I have some XSLT which generates some html with a few ASP.NET Link Button Controls String mstring = sw.ToString(); var myctrl = Page.ParseControl(mstring); foreach (Control Control in myctrl.Controls) …
James Campbell
  • 5,057
  • 2
  • 35
  • 54
0
votes
1 answer

How to access Dynamically loaded server control of Master Page in content page?

I have created Master page and from content page, loaded some server controls to Master Page. Control ctrl = Page.ParseControl(result); ContentPlaceHolder cph = (ContentPlaceHolder)this.Page.Master.FindControl("ContentPlaceHolder1"); …
Tom Cruise
  • 1,395
  • 11
  • 30
  • 58
0
votes
1 answer

what's the ASP.NET method to load a server control by parsing from a string

I believe I have seen a method for doing this, but I do not remember. I am trying to load a control using something like: string str = ""; Control ctrl =…