Getting HTML Source code for selected area

Posted on 2006-04-25
Last Modified: 2010-08-05
In C# programming, I have displayed a webpage in WebBrower Component and can get the source code for that page. However, I wonder how can I get the source code for a SELECTED AREA in that webpage. Like the way you see in DREAMWEAVER (once you selected some controls in DESIGN window, you will see the corresponding HTML code in CODE window).

Many thank for quick answers and tips of how to do that task.
Question by:bBK
    LVL 4

    Expert Comment

    There are an attribute that allows to "move" and "edit" the content of a region in an executing web page. I don't remember the attribute name, but the name contains the word "content". Is like "editablecontent" or something like that.

    Anyway, check this link below. It gives you more hints.

    good luck

    Author Comment

    I'll check it now.


    Author Comment

    Sorry, but it's not what I want. The link u gave just only about DHTML with dynamic content. :(

    LVL 4

    Accepted Solution

    bBk, (by the way, do you speak spnsh?)

    the link helps you just to get the content of a control.
    A selected area inside a control can be captured with the Range method.
    For example, a selected area into a textarea (with javascript):

    var selectedText = textEdit.document.selection.createRange().text;
    var boldedText = "<b>" + selectedText + "</b>";

    LVL 4

    Expert Comment

    I guess my answer helped bBk to solve his doubt, otherwise, he would have aswered back again.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now