Dan Rivera
Dan Rivera

Reputation: 1

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 = "<asp:label id=\"myLabel\" runat=\"server\" />";

Control ctrl = SomeMagicalLoadControlMethod(str);
Page.controls.add(ctrl);

Is there a method for this?

And yes, I am familiar with the LoadControl method, but that's not what I need.

Update:

The method I was thinking of was ParseControl.

To help anyone else out..

Control ctrl = ParseControl("<asp:label id=\"myLabel\" runat=\"server\" />");

Upvotes: 0

Views: 105

Answers (1)

Icarus
Icarus

Reputation: 63966

I cannot imagine doing something like what you describe. It looks like such as horrendous thing to do that if indeed this is possible, I would rather forget that I saw it and rethink my approach.

Upvotes: 1

Related Questions