Objectmix
Tags Register Mark Forums Read

Writing directly to ContentPlaceHolder : DOTNET

This is a discussion on Writing directly to ContentPlaceHolder within the DOTNET forums in Framework and Interface Programming category; Hello. I have a simple question: it is possible to write directly to contentplaceholder just like to the page? I'm looking for a way to put text directly in the same way like Response.Write("Some example text"), but can't figure out how to do it. For now I created the Literal control and all text pushed into Text properties of this control, but I don't like it. Some advice ? best, Slawomir...


Object Mix > Framework and Interface Programming > DOTNET > Writing directly to ContentPlaceHolder

DOTNET Discussion forums related to Microsoft Dot net technologies, CSharp and other related items

Reply

 

LinkBack Thread Tools
  #1  
Old 07-19-2007, 06:48 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Writing directly to ContentPlaceHolder

Hello.

I have a simple question: it is possible to write directly to
contentplaceholder just like to the page? I'm looking for a way to put
text directly in the same way like Response.Write("Some example text"),
but can't figure out how to do it. For now I created the Literal control
and all text pushed into Text properties of this control, but I don't
like it. Some advice ?

best,
Slawomir
Reply With Quote
  #2  
Old 07-19-2007, 07:05 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Writing directly to ContentPlaceHolder

The Literal is made precisely for your purpose. Why don't you like it? The
Placeholder is intended as a container for other controls.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Slawomir" <spasko.usunto@o2.pl> wrote in message
news:f7nj0r$3v7$1@node2.news.atman.pl...
> Hello.
>
> I have a simple question: it is possible to write directly to
> contentplaceholder just like to the page? I'm looking for a way to put
> text directly in the same way like Response.Write("Some example text"),
> but can't figure out how to do it. For now I created the Literal control
> and all text pushed into Text properties of this control, but I don't like
> it. Some advice ?
>
> best,
> Slawomir



Reply With Quote
  #3  
Old 07-19-2007, 08:04 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Writing directly to ContentPlaceHolder

Eliyahu Goldin napisał(a):
> The Literal is made precisely for your purpose. Why don't you like it? The
> Placeholder is intended as a container for other controls.
>

I'm using on-line html editor (http://www.fckeditor.net/) to generate
page content. Pushing 50 lines of text seams to ... not elegant for me.

By the way - using on-line editor raise exception on my page. In English
its seams like:
"Potentially dangerous value detected in Request.Form coming from client
(MyFCKeditor="<p>&quot; some text...")". I can set RequestValidation to
"false", but I'm not sure about consequents. It's really potentially
unsave/dangerous ?

best,
Slawomir
Reply With Quote
  #4  
Old 07-19-2007, 10:15 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Writing directly to ContentPlaceHolder

the <p> is what triggers the error. if you do not handle the data
properly you can get script injection (sql or javascript, though the
test is only for javascript).


-- bruce (sqlwork.com)


Slawomir wrote:
> Eliyahu Goldin napisał(a):
>> The Literal is made precisely for your purpose. Why don't you like it?
>> The Placeholder is intended as a container for other controls.
>>

> I'm using on-line html editor (http://www.fckeditor.net/) to generate
> page content. Pushing 50 lines of text seams to ... not elegant for me.
>
> By the way - using on-line editor raise exception on my page. In English
> its seams like:
> "Potentially dangerous value detected in Request.Form coming from client
> (MyFCKeditor="<p>&quot; some text...")". I can set RequestValidation to
> "false", but I'm not sure about consequents. It's really potentially
> unsave/dangerous ?
>
> best,
> Slawomir

Reply With Quote
  #5  
Old 07-19-2007, 02:12 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Writing directly to ContentPlaceHolder

bruce barker napisał(a):
> the <p> is what triggers the error. if you do not handle the data
> properly you can get script injection (sql or javascript, though the
> test is only for javascript).
>
>
> -- bruce (sqlwork.com)
>


Yes, I understand that reason of the error is html block inside the
control, but this is exactly what I want. Maybe I will try to explain
whole situation:

I'm using on my web page (on admin part) fckeditor that generates html
structure of document. This "part" I'm writing to text file (news.txt)
and then displaying it on the web page. in Literal control. It of course
could contains <p>, <br>, <table>, <a> and other tags, because it
generates html page content.

Here is a link, where you can try to use it: http://www.fckeditor.net/demo
After finishing just click submit. This (generated) code a need to
include as part of my page (in contentplaceholder).

Here is my code to save html tags from admin page

protected void SaveClick(object sender, EventArgs e)
{
using (StreamWriter sw = new
StreamWriter(MapPath(@"/RZESA/inc/news.txt"), false))
{
sw.Write(FCKeditor1.Value);
}
}

.... and code to restore it on internet website.
protected void Page_Load(object sender, EventArgs e)
{
using (StreamReader sr = new
StreamReader(MapPath(@"/RZESA/inc/news.txt")))
{
Literal1.Text = sr.ReadToEnd();
}
}

As you can see the point is to pass this text (html code) to web page.
Maybe is other, more secure way to do this ?

best,
Slawomir


Reply With Quote
Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
FCKEditor not working in contentplaceholder usenet DOTNET 0 12-02-2007 03:31 PM
ContentPlaceHolder Resizing with Dynamic TreeView usenet DOTNET 1 11-04-2007 07:53 PM
ContentPlaceHolder Problem usenet DOTNET 2 09-07-2007 05:36 PM
ContentPlaceHolder under a DIV tag - Visual Studio Design view? usenet DOTNET 4 07-17-2007 04:15 AM
Reading Directly from a URL usenet Java 4 08-19-2006 08:51 PM


All times are GMT -5. The time now is 11:08 PM.