Re: Converting html string to object

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Wouter vanEck (wouter.vaneck_at_smart-quotes.com)
Date: 01/07/05


Date: Fri, 7 Jan 2005 12:03:13 -0700

Hi John,

It is not the answer I was hoping for, I am currently trying to work with
rendering the string to the page.. same result unless I am doing it wrong.

Wouter

"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:OtPFNhO9EHA.1524@TK2MSFTNGP09.phx.gbl...
> "Wouter vanEck" <wouter.vaneck@smart-quotes.com> wrote in message
> news:uPu7bVO9EHA.2196@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > I need to find a way to read a html type string from a database and add
it
> > to a placeholder control on the page and then I need to be able to
> > populate
> > the fields that were in that html string at run time.
> >
> > The html string may look like this "<table><tr><td>First
> > Name</td><td><input
> > name=_firstname runat=server id=_firstname ....></td></tr></table>"
> >
> > Is there a way to convert this string into an object which you could
> > access
> > like _firstname.text or _firstname.innerhtml, any thing to being able to
> > set
> > the value would be great.
> >
> > Is there anyone who knows about an article or has an idea how to go
about
> > doing this??
>
> You can't do this directly. If you can turn the database contents into a
> user control (.ascx file) on disk, then you can load it with LoadControl.
>
> Other than that, you'll have to parse the HTML string by yourself, using
> regular expressions or something.
>
> This appears to have been designed on the assumption that you can turn a
> string into a set of server-side controls. If this turns out not to be the
> case, and if you can't do the user control trick, then perhaps you could
> change design a bit. If the string in the database were a bit easier to
> parse for "fields", you'd have better luck with it. For instance, it could
> contain strings like %fieldName%. That's pretty easy to parse for. It's a
> lot easier to parse for than runat="server" id="_firstname".
>
> John Saunders
>
>



Relevant Pages

  • Raise Event not working (revised)
    ... I am trying to raise a custom event in this user control passing custom data ... protected void HandleChangedEvent(object sender, ChangedFieldsEventArgs ... public ChangedFieldsEventArgs(int row, int col, string newVal, string ...
    (microsoft.public.dotnet.languages.csharp)
  • c# Event raising problem (revised)
    ... I am trying to raise a custom event in this user control passing custom data ... protected void HandleChangedEvent(object sender, ChangedFieldsEventArgs ... public ChangedFieldsEventArgs(int row, int col, string newVal, string ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: parser error
    ... 'myApp.pcReport' is an user control. ... > at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, ... > at System.Web.UI.TemplateParser.ParseString(String text, String ... > virtualPath, String basePhysicalDir) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Calculator
    ... Taking that string, you could create the code that I laid out for you. ... create a code segment and compile and run it). ... >>> I'm developing a user control with a textbox inside. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UserControl Probelm
    ... >> Actually I have a user control which has nine hyperlinks.What I want ... >> Sunil Sabir ... > Public Property valr1CssAs String ... > Private Sub Page_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.aspnet)