This is a migrated thread and some comments may be shown as answers.

RadEditor Image gallery viewstate issues

1 Answer 55 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jaime
Top achievements
Rank 1
Jaime asked on 31 Dec 2008, 01:14 AM
Hi guys.
Im building a blog using the radeditor. Im trying to control the amount of images uploaded by any user using the FileUploadEvent.
The thing is im storing the ammount of images uploaded on the control (the blog control)'s viewstate. The thing is, when I ask for the viewstate (and actually for any other control contained on the Blog Control, for example a given text field) It returns me a null.
Here's the code:

int currentUploadedImages = Entry.ImageCount;
        currentUploadedImages++;
        if (currentUploadedImages > 4) {
            File.Delete(fileName);
            EntryMessage.ShowMessage("Lo sentimos, sólo puedes cargar 4 imágenes por relato. Elimina una de las imágenes ya cargadas e inténtalo de nuevo."
                , ModalMessageType.Forbidden);
        }
        Entry.ImageCount = currentUploadedImages;
        return true;

Also the rad editor is displaying the stylesheet loaded by the Masterpage/Page and I dont need it to do it.
Aditionally I have an Image wich displays a modal pop up extender that has the post's preview. In firefox works great, but in internet explorer the function isn't fired until any other control does a "postback" (for example I have a button that tags the entry, if I tag the entry and then press the preview works great, but If I haven't done anything it doesnt fires the javascript function

By the way. The Blog Control is inside an ajax update panel

Merry Xmas , Happy new Year and thanks for the help
Regards
Jaime.

1 Answer, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 06 Jan 2009, 12:25 PM
Hi Jaime,

The FileUploadEvent is not fired like a normal server-side event, because its handler code is in a different page - the event is raised from the editor dialog, which is a separate page from the one containing the RadEditor control. This is why it is not possible to rely on the ViewState object in the handler code - you need to use an object that can persist your data between pages - for example the Session.

For your second question - by default the editor will use all stylesheets from the page it is on. This includes the styles from your master page. You can control which stylesheets should be in the content area using the CssFiles editor property. The property holds a list of URLs for the CSS file you want to use. You can set it from the code file or from the editor tools file - http://www.telerik.com/help/aspnet-ajax/externalcssfiles.html.

We are not sure what the problem is with the preview feature of your control. You can check if it is related to the editor by replacing the RadEditor control with a simple textbox and verifying whether the preview works in IE then.

If the information provided cannot help you resolve your problem I suggest to open a support ticket and send us a sample working version of your project. We will do our best to help you.

Kind regards,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Jaime
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Share this question
or