Override space output in editor?

Originally Posted 15 May 2017, 7:54 am EST

  • Originally Posted 15 May 2017, 7:54 am EST

    hi,

    I have a scenario where i would like to convert default space html code from " " to " " when user presses spacebar.

    Thanks

  • Marked as Answer

    Reply

    Hi,

    If I understand your requirement properly, then you need to have custom text (eg "//") whenever the end user presses Space key. If it is so, then you may use C1Editor's KeyDown event and set Handled to true, this will indicate that we are manually handling this event. Then append text to C1Editor's Text as follows:
    e.Handled = true;
    string text = "//";
    c1Editor1.Text = c1Editor1.Text + text;
    c1Editor1.Select(c1Editor1.Text.Length, 0);

    I have attached a sample application for your reference.

    Let me know if I misinterpret your requirement.

    Thanks & Regards
    Ruchir Agarwal
    2017/05/prj_C1EditorCustomTextOnSpaceKey.zip
Need extra support?

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

Learn More

Forum Channels