473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
2 1581
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Trillium | last post by:
I am trying to upgrade a straight ASP project into .NET, but I am new at ..NET, and there seem to be so many different ways to do things. I am new to ..NET and need some guidance as to which...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
2
by: Quentin Huo | last post by:
Hi: I have a user control and I want to dynamically create a Label control and TextBox control when the button "add more author name" is clicked. I did like this: 1. there is a...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
15
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
12
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the...
9
by: Chris | last post by:
I am dynamically adding a user control to each row in a gridview. The reason I am doing it dynamically is the user control is different depending on certain data in the gridview. The gridview...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.