|
Home > Archive > Microsoft Content Management Server > July 2006 > How to save a placeholder content to an independent database
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to save a placeholder content to an independent database
|
|
| Hrvoje Vrbanc 2006-07-27, 7:23 am |
| Hello all,
for some reasons, I would like to save the content entered in a
HtmlPlaceholder into a CMS-independent database for further manipulation. I
have added the separate button on the template page and used the following
code in the onClick event:
Imports Microsoft.ContentManagement.Publishing.Extensions.Placeholders
Dim strContent As String = CType(HtmlPlaceholderControl1.BoundPlaceholder,
HtmlPlaceholder).Html.ToString
(...and then some ADO code for saving the string into a database)
It works, but....it doesn't "suck" the HTML code from the placeholder but
only pure displayed text, i.e., let's say this is the contenet of my
placeholder:
<P>This is just <A href="http://www.grok.com"><STRONG>a test
link</STRONG>.</A></P>
The entry in the database table would look like this:
This is just a test link.
Therefore, no HTML tags are transmitted. What could I do to save the whole
HTML source?
Thank you in advance,
Hrvoje
| |
| Stefan [MSFT] 2006-07-27, 1:21 pm |
| Hi Hrovje,
I would suggest to debug the code.
does your strContent string contain the correct data?
If yes, then the content is correctly read from MCMS (what I would expect).
So the additional info is lost on the code after this.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:OoIb7CWsGHA.3832@TK2MSFTNGP06.phx.gbl...
> Hello all,
>
> for some reasons, I would like to save the content entered in a
> HtmlPlaceholder into a CMS-independent database for further manipulation.
> I have added the separate button on the template page and used the
> following code in the onClick event:
>
> Imports Microsoft.ContentManagement.Publishing.Extensions.Placeholders
>
> Dim strContent As String = CType(HtmlPlaceholderControl1.BoundPlaceholder,
> HtmlPlaceholder).Html.ToString
>
> (...and then some ADO code for saving the string into a database)
>
> It works, but....it doesn't "suck" the HTML code from the placeholder but
> only pure displayed text, i.e., let's say this is the contenet of my
> placeholder:
>
> <P>This is just <A href="http://www.grok.com"><STRONG>a test
> link</STRONG>.</A></P>
>
> The entry in the database table would look like this:
>
> This is just a test link.
>
> Therefore, no HTML tags are transmitted. What could I do to save the whole
> HTML source?
>
> Thank you in advance,
> Hrvoje
>
>
>
| |
| Hrvoje Vrbanc 2006-07-27, 1:21 pm |
| Hello Stefan,
thanks for the reply. I'm puzzled too as I would expect no problems with
this operation.
The strContent variable seems to be incorrectly read...I tried with finding
a substring in it that is positively the part of the placeholder's HTML code
(but as a HTML tag, not as displayed text) and it was not found. I also
displayed the content of strContent with response.write() or anything but
it's always the same.
I must remark that my button's onClick event occurs while the posting is in
the edit mode, not in the live mode, I don't know whether it makes any
difference.
Thank you,
Hrvoje
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:OXvpOoXsGHA.1976@TK2MSFTNGP02.phx.gbl...
> Hi Hrovje,
>
> I would suggest to debug the code.
> does your strContent string contain the correct data?
> If yes, then the content is correctly read from MCMS (what I would
> expect).
>
> So the additional info is lost on the code after this.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS:
> http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:OoIb7CWsGHA.3832@TK2MSFTNGP06.phx.gbl...
>
>
| |
| Stefan [MSFT] 2006-07-27, 1:21 pm |
| Hi Hrovje,
please test in the debugger and inspect the strContent variable.
Can you confirm that the content is incorrect when looking here?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:eC37Q2XsGHA.1284@TK2MSFTNGP05.phx.gbl...
> Hello Stefan,
>
> thanks for the reply. I'm puzzled too as I would expect no problems with
> this operation.
>
> The strContent variable seems to be incorrectly read...I tried with
> finding a substring in it that is positively the part of the placeholder's
> HTML code (but as a HTML tag, not as displayed text) and it was not found.
> I also displayed the content of strContent with response.write() or
> anything but it's always the same.
>
> I must remark that my button's onClick event occurs while the posting is
> in the edit mode, not in the live mode, I don't know whether it makes any
> difference.
>
> Thank you,
> Hrvoje
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:OXvpOoXsGHA.1976@TK2MSFTNGP02.phx.gbl...
>
>
| |
| Stefan [MSFT] 2006-07-27, 1:21 pm |
| Hi Hrovje,
just to add: what you will get is the content saved in the database - not
the content you can see in your browser as this content has not yet been
saved.
Take this into consideration when trying to determine if the correct content
has been read.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:eC37Q2XsGHA.1284@TK2MSFTNGP05.phx.gbl...
> Hello Stefan,
>
> thanks for the reply. I'm puzzled too as I would expect no problems with
> this operation.
>
> The strContent variable seems to be incorrectly read...I tried with
> finding a substring in it that is positively the part of the placeholder's
> HTML code (but as a HTML tag, not as displayed text) and it was not found.
> I also displayed the content of strContent with response.write() or
> anything but it's always the same.
>
> I must remark that my button's onClick event occurs while the posting is
> in the edit mode, not in the live mode, I don't know whether it makes any
> difference.
>
> Thank you,
> Hrvoje
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:OXvpOoXsGHA.1976@TK2MSFTNGP02.phx.gbl...
>
>
| |
| Hrvoje Vrbanc 2006-07-28, 7:21 am |
| Thanks!
However, now I have a silly question: how should I start the debugger
considering that I cannot start the application from Visual Studio as it
requires CmsHttpContext for a posting in order to run?
Kind regards,
Hrvoje
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:u2LhVVYsGHA.356@TK2MSFTNGP05.phx.gbl...
> Hi Hrovje,
>
> just to add: what you will get is the content saved in the database - not
> the content you can see in your browser as this content has not yet been
> saved.
> Take this into consideration when trying to determine if the correct
> content has been read.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS:
> http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:eC37Q2XsGHA.1284@TK2MSFTNGP05.phx.gbl...
>
>
| |
| Stefan [MSFT] 2006-07-28, 7:21 am |
| Hi Hrovje,
the easiest thing is to use the steps in the "Attach directly to the
process" section of this article:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm#0472C0F2-FF56-4677-B4F8-B2986CF526E5
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:OnUb2fhsGHA.1580@TK2MSFTNGP05.phx.gbl...
> Thanks!
> However, now I have a silly question: how should I start the debugger
> considering that I cannot start the application from Visual Studio as it
> requires CmsHttpContext for a posting in order to run?
>
> Kind regards,
> Hrvoje
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:u2LhVVYsGHA.356@TK2MSFTNGP05.phx.gbl...
>
>
| |
| Hrvoje Vrbanc 2006-07-28, 1:20 pm |
| I have tested it more and discovered an interesting new devlopment (behaving
somewhat different than before):
- when the button is clicked in edit mode (i.e. the placeholder content is
not yet saved in the CMS database but is entered in the texbox/placeholder),
it then saves NOTHING to the database
- if a posting is saved or submitted, then the full content of the
placeholder is saved into a database (with HTML tags)
- even if I'm currently in the edit mode and change the content of the
placeholder and then click the button, it will again save the content saved
before, not the newly entered content....until I click "Save", of course.
OK, now it makes sense to me: in order to save a placeholder content in a
separate database, the posting must be saved in the CMS database beforehand.
However, is there a way to read the content of the placeholder in the edit
mode before it's saved, just after it's entered in the edited placeholder?
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:OX6Uy6hsGHA.4264@TK2MSFTNGP04.phx.gbl...
> Hi Hrovje,
>
> the easiest thing is to use the steps in the "Attach directly to the
> process" section of this article:
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm#0472C0F2-FF56-4677-B4F8-B2986CF526E5
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS:
> http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:OnUb2fhsGHA.1580@TK2MSFTNGP05.phx.gbl...
>
>
| |
| Hrvoje Vrbanc 2006-07-28, 1:20 pm |
| I forgot to ask one thing: if saving of the posting is necessary, is it
possible to wire some custom code on the "Save" button in the CMS console?
That way the posting would be saved in the CMS database and the content of
my placeholder in a separate database, all with one click on the button/link
in the CMS console.
Thank you,
Hrvoje
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:OfSPbZksGHA.3832@TK2MSFTNGP06.phx.gbl...
>I have tested it more and discovered an interesting new devlopment
>(behaving somewhat different than before):
>
> - when the button is clicked in edit mode (i.e. the placeholder content is
> not yet saved in the CMS database but is entered in the
> texbox/placeholder), it then saves NOTHING to the database
> - if a posting is saved or submitted, then the full content of the
> placeholder is saved into a database (with HTML tags)
> - even if I'm currently in the edit mode and change the content of the
> placeholder and then click the button, it will again save the content
> saved before, not the newly entered content....until I click "Save", of
> course.
>
> OK, now it makes sense to me: in order to save a placeholder content in a
> separate database, the posting must be saved in the CMS database
> beforehand. However, is there a way to read the content of the placeholder
> in the edit mode before it's saved, just after it's entered in the edited
> placeholder?
>
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:OX6Uy6hsGHA.4264@TK2MSFTNGP04.phx.gbl...
>
>
| |
| Stefan [MSFT] 2006-07-28, 1:20 pm |
| Hi Hrovje,
please debug the code with the steps I outlined below and tell us the
findings of the debugging.
Thanks,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
"Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
news:uv21LcksGHA.4752@TK2MSFTNGP02.phx.gbl...
>I forgot to ask one thing: if saving of the posting is necessary, is it
>possible to wire some custom code on the "Save" button in the CMS console?
>That way the posting would be saved in the CMS database and the content of
>my placeholder in a separate database, all with one click on the
>button/link in the CMS console.
>
> Thank you,
> Hrvoje
>
>
>
> "Hrvoje Vrbanc" <hrvojev@recro.hr> wrote in message
> news:OfSPbZksGHA.3832@TK2MSFTNGP06.phx.gbl...
>
>
|
|
|
|
|