Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

rousso's .net blog

the .net blog of Yannis Roussochatzakis
CS:Editor ViewState

Quick Tip:

CommunityServer 2.1 uses TinyMCE as a rich text editor. They use what appears to be a wrapper to TinyMCE: CommunityServer.Controls.Editor. As I am developing an application on top of CS 2.1 I am using the same rich text editor and encountered the following problem:

I was setting declaratively the Height Property of the Editor control, but it could not retain it's value after postbacks.

Look at the ASPX part:

<%@ Register Assembly="CommunityServer.Controls" Namespace="CommunityServer.Controls" TagPrefix="CS" %>
<CS:Editor ID="edtNotes" runat="server" Height="160px" />

So far so good but, after a postback the Editor control returned to its default height (messing-up my layout).

To make a long story short, it figured that something is wrong either with timing or with implementation. I mean that either the wrapper, or the wrapped control do not assign the value of Height before ViewState is saved, or they assign it to either a Property that is not saved in view state, or during an Event that fires before LoadViewState.

So what I did to work-around the issue was just disable ViewState in the Editor control.

<CS:Editor ID="edtNotes" runat="server" Height="160px" EnableViewState="false" />

The problem has gone away and that means that LoadViewState was overwriting my value.

I did not devote any time in looking further into this matter so I'm just posting this work-around, but if I do, I 'll let you know the details.

Share
Posted: Τρίτη, 19 Σεπτεμβρίου 2006 11:49 πμ από το μέλος rousso
Δημοσίευση στην κατηγορία:

Σχόλια:

Χωρίς Σχόλια

Έχει απενεργοποιηθεί η προσθήκη σχολίων από ανώνυμα μέλη