Html Text Editor problem - asp.net

Hii,
I m using a simple HTML Text editor by providig 'contentEditable' property of a div to true. All the formatting operations are working fine. The problem is when i copy and paste some html contents from somewhere else and try to post to DB the entire content may not post in to db because of the size limitation of the column. Is there any solution regarding this? I m using sql server 2008

What DB are you running?
The only solution to that is to choose a field type and size that's appropriate for the data you are going to be storing there; or if you can't do that save the contents in a file and store the file location in the DB.

Related

How to show image from the oracle database in asp.net

Hi there i need to show an image stored in the oracle database in (blob format i think).i have retrieved the image from database in dataset = dt.rows[0]["image"].how can convert the image to show it on the page.
Thanks.
In order to display it on a page, you need to serve the image as a separate resource from the web server.
Meaning, your page.aspx will have a tag with a src="your_image.aspx". In your_image.aspx, you need to clear response headers, make sure the Content-type is set correctly (image/jpg or something similar), put the contents of dt.rows[0]["image"] into a byte array and then write it out the binary image with something like Response.BinaryWrite(yourByteArray).
This is just a general outline. Use the googles for details :)

Display FORMATTED XML

I am retrieving an XML document from a web service (UPS actually), and I can pull the information I need from the XML, but I can't get the XML to display in the XML format. I can get it to display in a label and literal, but its all ran together. The nodes aren't displaying. The nodes display in a text box control, but it still runs together (no brks)
Any idea how to take the XML document that i get from the service and display it just like it would if you open up an XML doc in IE?
Thanks
BTW... i have search all day for this and the only thing i could find is if i was displaying a static file, which i'm not. I also tried doing the stringbuilder/stringwriter, but no luck. I'm still pretty new at this stuff so i could be missing something.
HELP... PLEASE!
Try encompassing the XML in the
<pre>... your xml</pre>
tags.

Save image name or path into database

I'm doing an intranet for the employees of the company using ASP.NET and SQL Server, on the profile section i have an upload picture area (image field to show the picture, input to select the file, and the load button), this is working fine, the picture is loading into a folder, but, also i have the text fields where the user adds his info, this is also working great and is saving into the database, what now i want to do is that the user uploads the picture, and finish with all the text fields when he clicks the submit button to send all the fields into the database the name or the path of the picture he uploaded goes into the database too, all my textfields are being saved using an sqlDataSource with insertParameters.
Any idea how to do it?? i would prefer to do it with the front side code, since on the code behind i just have initializing the SqlDataSource1.Insert();
Do not save the images to disk, doing so will result in ugly mess sooner or later.
What you should do is to allow the user to upload the image, resize/crop the image on the server, convert the image to base64 and save the base64 string into varchar(max) column.
Because you are saving only small images(avatars), this solution should work without any problems.
Also when you fetch the image base64 string back from the DB, you can embed it straight into HTML if IE7 is not a requirement. Here is a list of browsers that support Data URI scheme
If embeding base64 into HTML doesn't work out, bulld an ASP.NET page that decodes the base64 string into an image and returns a binary response. Then utilise it in your page like this:
<img src="http://www.example.com/images.aspx?thimageDBrowID=12345" width="20" height="20"/>
If you're using SQL Server 2008 you can look into using FILESTREAM

HTML editor and image upload to server

In asp.net, when we work with any html editor, I often include images and text. How will images upload to a specific folder in the server and be saved as a relative path in the db. I Need this concept for a CMS.
I was using CKEditor first but it was found a bit difficult to work with asp.net. So I moved to obout editor. I think your problem can be solved with obout html editor. check this link, obout.com - Html Editor - Image upload
Why do you need to store the image's relative path in the DB ? As there is no need, because the content html is saved in the DB and when you the retrieve that content that particular image will be shown in the content.
As far as I have used CK Editor, there is some setting required in the config file to set the path where the images are stored when user adds images in content.

how to store and retrieve images for user articles

I have a web site in which users post news to site.
so i have two field in my database NewsTitle and NewsBody.
The Newsbody can have images.
What datatype should I use for NewsBody?
I don't want images loaded from image hosting site, I want images save in my database or in my web site's host.
What is the best way to implement this, should I use ajaxcontroltoolkit?
any ideas?
You can set your the datatype as varchar as the filename of your image, since all you need to know when you try to display the image is the filename. (but of course, you must already know the location of this file)
I think u can use ListView and the template field will contain asp:image.you can store the image name in the database and bind the imageUrl through the image directory in your system plus the image name.

Resources