473,659 Members | 3,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 & " " &
strContentEdita ble & " 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 1593
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*********@po ole.gov.uk> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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 & " " &
strContentEdita ble & " 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 'contenteditabl e' 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
1331
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 approach to take. My application is to collect answers to an indeterminate number of questions, which are defined in a database. The definition includes the question content, type of control and validation for the data. In ASP, the application...
4
5476
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 dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
2
2203
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 "PlaceHolder" control "ph" in the user control; 2. create a Label control and TextBox control when in the "add" button
2
2907
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 avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
15
26503
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
11068
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
12
13197
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 same Tag number. (I thought it might help) The checkboxes name is a concatenation of "chkCancel" and a number that represents the order in which they were created: chkCancel0 (Tag = 0) chkCancel1 (Tag = 1)
9
7920
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 contains a placeholder and I add the control to it, the user control is a formview bound to an object datsource. This works great until I post back the page and the user control disappears. What am I doing wrong? Regards, Chris. Protected Sub...
4
4475
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 selected, the row is added using JavaScript. The script uses cloneNode to clone a hidden template row and all of its children and then adds the new row to the table, updates all of the child control Ids and sets visibility etc. The hidden...
3
5259
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 add the pane the remove event does not get handled, though thereafter it is handled without problems. ==================================================
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.