Inserting standard HTML tags (in Design Mode) from custom context menu

Posted by: john.spencer on 4 November 2017, 6:51 am EST

    • Post Options:
    • Link

    Posted 4 November 2017, 6:51 am EST

    I am looking at using the Editor to design electronic data sheets (EDS will later be used to collect data on factory shop-floor).

    I am brand new to GrapeCity controls. What would be the best practice here to insert standard HTML tags such as or etc in the Design Mode?

    The users will be non-technical, so design mode will be blocked for them, they must be able to do all edits in Design mode.

    I was thinking of adding a custom context menu to the Editor control with option such as ‘Insert Text Field Numeric’, ‘Insert Text Field’ or ‘Insert Drop down’, etc.

    I would need to know the position of the cartet in the related HTML behind the Editor control and insert the HTML tags programatically. Any tips?

    Or is there a better way to achieve this?

    Thanks!

  • Posted 4 November 2017, 6:56 am EST

    “The users will be non-technical, so design mode will be blocked for them, they must be able to do all edits in Design mode.”

    Sorry, I mean ‘source view’ will be blocked for them.

  • Posted 4 November 2017, 1:23 pm EST

    Update: OK, I believe I cracked it, the above can be achieved with something like:

    • "c1EditorEDS.Selection.SetXmlElement(el);

      "

    But if you have other pointers, I’d appreciate.

  • Posted 6 November 2017, 1:41 am EST

    Hi John,

    To add any content to the C1Editor in the Design Mode, you can set its Text property. Also, XML property of the C1Editor can be used to add HTML Tags. You can use these properties at design time (from the property grid) and run-time.

    http://help.grapecity.com/componentone/NetHelp/c1editorwinforms/C1.Win.C1Editor.4~C1.Win.C1Editor.C1Editor~Text.html

    http://help.grapecity.com/componentone/NetHelp/c1editorwinforms/C1.Win.C1Editor.4~C1.Win.C1Editor.C1Editor~Xml.html

    At run-time, you can also make use of the LoadXml method of C1Editor to load the document from XML. You can learn about the various overloads of the same from the below documentation link:

    http://help.grapecity.com/componentone/NetHelp/c1editorwinforms/C1.Win.C1Editor.4~C1.Win.C1Editor.C1Editor~LoadXml.html

    A sample has been attached for your reference. Let us know if you need further assistance.

    Best Regards,

    Esha

    prj_C1Editor.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels