PDA

View Full Version : Adding HTML into form view fields


QBall777
09-24-2007, 12:09 PM
Hi

I am attempting to build my own content management system, so far I have a news section which is maintained by admin staff (me) The admin section allows you to add, delete and edit articles by using the standard form view controls. This all works fine but now I want to be able to add HTML in the description field, when I do this I get a server error (it will not accept html tags)

1.My first question is how do I change the field to allow html code.

When the form view changes to edit mode I would like to display a very simple html editor is this particular difficult,how would I go about applying this.

Last but not least I would like to be able to upload an image, again does anyone know a simple .net image uploader.

I have search online for these things but ended up getting in a right mess.

I hope someone could point me in the right direction.

Thank you.

ess
09-24-2007, 01:19 PM
By default, ASP.NET input validation is set to true for every single page....so, if you want to allow users to submit html code, here is what you need to do.

At the top of the page that processes the form, locate the <%@ Page ..... %> declaration (usually first line) and add the following inside it

validateRequest="False"

I would strongly recommend that you use the following library to ensure that data is filtered and prevent XSS attacks....well, most of them anyway.

http://www.microsoft.com/downloads/details.aspx?FamilyId=EFB9C819-53FF-4F82-BFAF-E11625130C25&displaylang=en

Cheers
~E

QBall777
09-25-2007, 03:10 PM
Thanks ess it worked nicely, I also downloaded the file you suggested.

Any clues for a good editor?

Thanks