Page 1 of 1

Mixing ASP.NET MVC and CSHTML5

Posted: Sat Feb 20, 2016 9:38 am
by licedey
Hello,

I have poor knowledge in front-end and want to find a workaround. My goal is to use output of CSHTML5 in ASP.NET MVC project.
After a day of researching (sorry) I've found such obstacles:
  1. Don't found a way for easy injecting HTML in C# code. For example it is strong need in pasting formated text. Workarounds for now is to use such code:

    Code: Select all

    dynamic panel = CSharpXamlForHtml5.DomManagement.GetDomElementFromControl(_rootPanel);
    dynamic txt = CSharpXamlForHtml5.DomManagement.Document.createElement("p");
    txt.innerHTML = "this is a text";
    panel.appendChild(txt);

    But the result is unexpected. Text is inserting at the bottom of panel or even dissapeared. Just adding TextBlock's maybe an option, but for large texts it is needed to write additional code to translate XML to textblock objects. Guide me please with a good way.
  2. In general how to add output of CSHTML5 to MVC project so I have 2 ways for end-user : to send them CHTML5 version of page, or regular view. Is there additional editions needed after copying files to dest folders. Already asked there also.

Thanks in advance.

Re: Mixing ASP.NET MVC and CSHTML5

Posted: Mon Feb 22, 2016 5:35 am
by JS-Support @Userware
Hello,
Thanks for your message.
1. -> Our current focus for Beta 8 is the Extensibility feature which makes it possible to call JS code from C# and to inject HTML5 code. Please wait for the Beta 8 for more samples regarding this feature. It is expected within 2 months.
2. -> Copying the generated JS files from the Output folder to a subfolder of the ASP.NET folder, and the merging the content of the generated "Index.html" with your own ASPX and HTML files should work fine. If you encounter errors, can you please post on these forums a simple minimal project that reproduces the issue?
Thanks again.
Regards,
JS-Support