By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Dynamically adding a control...I think! :)

P: n/a
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.

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

"Web Team @ Borough of Poole" <we*********@poole.gov.uk> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.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.

Nov 19 '05 #2

P: n/a
Hi Kevin,

Thanks for your answer - Although I think you may have missed my
objective here.

Whilst I do have an understanding of the HTML DOM, as far as my app is
concerned, when the user has finished editing, I am simply (!) saving a
string of text (Which happens to be HTML).

My problem is getting this string out of my custom control after the
user finishes editing and hits the 'save' button.

At present, my control (And there fore the containing page) is not
aware of the <span (its just a chunk of HTML written to the page which
happens to have a 'contenteditable' attribute.

What I need, is the SPAN to be a server control, which I can then do
something like this with when the user saves:

strPageData = me.editablespan.text
....Write strPageDate to a DB/txt/XML file.

Hope that makes sense.

Thanks again,
Simon.

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.