Well, for starters, a span is not a div. But as to your question, yes, I
believe that developing a custom Control that uses nested divs (Panels) is
the right way to go. In actual fact, you're probably talking about a whole
set of Controls and classes. An HTML document is not simply a long string of
text, but viewed abstractly, a set of a variety of objects that share the
same document space.
In an ASP.Net rich text editor, you might want to create or inherit Controls
that represent all of the HTML element types. When a user selects a type of
element from a drop-down list box, you could add one of those Controls to
the parent Control. When the user hits ENTER, you could add a new Paragraph
Control to the parent Control. And so on.
You do have your work cut out for you, however. HTML is a pretty complex
animal. Your Controls would have to support nesting, CSS and/or inline
styles, attributes, dragging and dropping, handling keyboard input,
client-side Clipboard support, etc. As Microsoft has already created such
Controls for any HTML element inside of the body of an HTML document, you
would probably want to inherit them and add the functionality for the rich
text editor to them. It would be an excellent idea to sit down and architect
how this app will work in some detail before writing any code.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
[quoted text, click to view] "Web Team @ Borough of Poole" <web.reports@poole.gov.uk> wrote in message
news:1126161171.435077.119940@z14g2000cwz.googlegroups.com...
> Hi All,
>
> I'm in the process of writing a eich text editor web custom control.
>
> The actual text/HTML is displayed/editied in a DIV layer, which I have
> created like this:
>
> output.Write("<span class=" & EditDivCSSClass & " id=" & Me.ID & " " &
> strContentEditable & " wrap>" & _strText & "</span>")
>
> I drag my control onto the containing page, set the strText property,
> which successfully ends up within the DIV. This is fine, until I come
> to saving the editied text, which I will need to get back from the
> control, then write to a DB/Txt file/XML...etc.
>
> I *think*, that rather than output.writing the DIV layer, I need to
> dynamically add a DIV/Layer control, which will then be accessible to
> my custom control, which in turn can return a property containing the
> string of user editied text.
>
> Can anyone point my in the right direction here? Am I thinking about
> this the right way?
>
> Thanks for any help!
>
> Simon.
>