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??
Thanks,
Wouter 10 3280
"Wouter vanEck" <wo***********@smart-quotes.com> wrote in message
news:uP**************@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??
Thanks,
Wouter
You can put a placeholder (say it is called plc1) on a page and then in code
do the following
plc1.controls.add(New literalcontrol(yourhtmltext))
Then on postback get the request.form("_firstname") . Take the runat out of
the hmtltext
Hi,
Thanks for your quick response but I was actually trying to push a value to
the field. The reading part is easy, just like you said, but I need to be
able to populate the field after a postback.
Wouter
"vMike" <Mi****************@noZorY.geZwaYrrenY.com> wrote in message
news:cr**********@ngspool-d02.news.aol.com... "Wouter vanEck" <wo***********@smart-quotes.com> wrote in message news:uP**************@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??
Thanks,
Wouter You can put a placeholder (say it is called plc1) on a page and then in
code do the following plc1.controls.add(New literalcontrol(yourhtmltext))
Then on postback get the request.form("_firstname") . Take the runat out
of the hmtltext
"Wouter vanEck" <wo***********@smart-quotes.com> wrote in message
news:uP**************@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
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:Ot**************@TK2MSFTNGP09.phx.gbl... "Wouter vanEck" <wo***********@smart-quotes.com> wrote in message news:uP**************@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
"Wouter vanEck" <wo***********@smart-quotes.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hi,
Thanks for your quick response but I was actually trying to push a value
to the field. The reading part is easy, just like you said, but I need to be able to populate the field after a postback.
If that is you only option then you could probably override the render of
the placeholder and do a some kind of string replace before output, but you
might want to consider some other approach.
"Wouter vanEck" <wo***********@smart-quotes.com> wrote in message
news:uf**************@TK2MSFTNGP15.phx.gbl... 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.
Are you aware that the runat="server" in these controls is meaningless?
John Saunders
:-)
Now I do...
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl... "Wouter vanEck" <wo***********@smart-quotes.com> wrote in message news:uf**************@TK2MSFTNGP15.phx.gbl... 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. Are you aware that the runat="server" in these controls is meaningless?
John Saunders
"Wouter vanEck" <wo***********@smart-quotes.com> wrote in message
news:uP**************@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??
Thanks,
Actual something like this might work for you. plc1 is a placeholder
control.
dim strtext as string = "<table><tr><td>First Name</td><td><input
runat='server' id='_firstname'></td></tr></table>"
dim ctrl as control = parsecontrol(strtext)
ctrl.id = "ctrl1"
dim ctrl2 as htmlinputcontrol = ctype(ctrl.controls(1),htmlcontrol)
ctrl2.value = "yourvaluefor input box"
plc1.controls.add(ctrl)
On Fri, 7 Jan 2005 11:18:14 -0700 in
microsoft.public.dotnet.framework.aspnet, "Wouter vanEck"
<wo***********@smart-quotes.com> wrote: 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??
Thanks,
Wouter
Hi Wouter,
Not sure off hand how to convert your string into an object, but you
can easily convert your string into a control like so:
string sSomeHtmlString = get string from database();
Control ctrl = Page.ParseControl(sSomeHtmlString); // Create control
Form1.Controls.Add(ctrl); // Add control to the Form
During postbacks, using FindControl("_firstname") to get at individual
values. Likewise you could also set each value as needed.
Hopefully this is what you're looking for.
Roger
Hi Roger,
Excellent!!! Works like a charm.
Wouter
"Roger Helliwell" <rh********@telus.net> wrote in message
news:tt********************************@4ax.com... On Fri, 7 Jan 2005 11:18:14 -0700 in microsoft.public.dotnet.framework.aspnet, "Wouter vanEck" <wo***********@smart-quotes.com> wrote:
Hi,
I need to find a way to read a html type string from a database and add
itto a placeholder control on the page and then I need to be able to
populatethe fields that were in that html string at run time.
The html string may look like this "<table><tr><td>First
Name</td><td><inputname=_firstname runat=server id=_firstname ....></td></tr></table>"
Is there a way to convert this string into an object which you could
accesslike _firstname.text or _firstname.innerhtml, any thing to being able to
setthe value would be great.
Is there anyone who knows about an article or has an idea how to go about doing this??
Thanks,
Wouter
Hi Wouter,
Not sure off hand how to convert your string into an object, but you can easily convert your string into a control like so:
string sSomeHtmlString = get string from database(); Control ctrl = Page.ParseControl(sSomeHtmlString); // Create control Form1.Controls.Add(ctrl); // Add control to the Form
During postbacks, using FindControl("_firstname") to get at individual values. Likewise you could also set each value as needed.
Hopefully this is what you're looking for. Roger This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: D Elkins |
last post by:
Here is my situation:
I have several arrays ... let's say ... Bob1_1, Bob1_2, etc.
Each array has several elements ... element 1 is the one I am
interested in.
Example:
Bob1_1=new...
|
by: DigitalRick |
last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my
guestbook. It had been working fine untill I upgraded to Server 2003 (I am
also running Exchange 2003) all locally. I...
|
by: Asbjørn Ulsberg |
last post by:
Hi.
I'm trying to convert Brady Hegberg's great RTF2HTML VB 6.0
module to C#. I've managed to convert the VB code to VB.NET,
which gave me the following code:
Option Strict On
Option...
|
by: Wallace |
last post by:
Hai,
Can anyone tell how to convert an object into string?
Please help me.... urgent..
Thanx in advance...
|
by: gg9h0st |
last post by:
i'm a newbie studying php.
i was into array part on tutorial and it says
i'll get an array having keys that from member variable's name
by converting an object to array.
i guessed "i can...
|
by: Terry |
last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces.
One of the major uses is to be able to split out Read-only access to an
obect. Let me give you a simple (contrived)...
|
by: k.vanderstarren |
last post by:
Hi All,
I'm trying to convert some ASP.NET code that I found at
http://weblogs.asp.net/dannychen/archive/2005/12/02/432190.aspx from VB
to C#.
I've managed to convert the portion that is in...
|
by: CoreyWhite |
last post by:
Problem:
You have numbers in string format, but you need to convert them to a
numeric type, such as an int or float.
Solution:
You can do this with the standard library functions. The...
|
by: Michelle Sollicito eBarster |
last post by:
Ok I know a lot of asp but not a lot of asp.net and C# so please bear
with me. I need some help converting..
In my asp project I have some styles in my head tag that change
according to a...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |