How do you embed a C# Form into HTML? - c#

I've used Visual Studio Express to create a C# Form but I want to embed it in my website. I'm quite new to C# and Html and I would like to know how to embed a C# Form in Html. Just to let you know I am using Weebly and there is a custom Html element that i wish to place a C# Form in.

Internet Explorer can host .NET controls, but it is not recommended any more - this feature has been deprecated by Microsoft, replaced by Silverlight. I'm not sure what the current outlook is on the future of Silverlight.

Related

How do I dynamically load HTML into a Winforms WebViewControl?

The Visual Studio WebView component uses the Microsoft Edge browser and is the upgraded version of the WebBrowser control that used older Internet Explorer technology, but the API is different.
Does anyone know the equivalent WebView control call for:
WebBrowser.DocumentText = "<html>Dynamic page content</html>";
I agree with the suggestion given by the #aepot that you can use the WebView.NavigateToString to load the dynamic HTML.
webView2.NavigateToString("<html> Test code </html>");
If it is a file then you can do like this:
webView2.NavigateToString(System.IO.File.ReadAllText(Application.StartupPath + "/11.html"));
OR
webView2.NavigateToLocal(#"\12.html");

Run server side C# script on Sharepoint Designer forms

My main goal with SharePoint is quite simple, I want to develop an intranet heavily based on tables and forms by using a tool/designer which doesn't force me to code all new/edit forms for List entries.
Presently I have a custom form in SharePoint designer to edit a list entry and I would like to add server side code (c#) in order to implement some specific behavior, for instance run a custom Page_Load function.
The issue is that I'm not sure how to do it and which would be the best approach, most of the examples online show an approach using Visual Studio and creating a new list (couldn't even find a way to use an existing SharePoint list) and then code the forms from scratch which I don't want.
So how can I enhance the SharePoint Designer pre-built form (image below) with server side (c#) and client side code (js) ? If possible I would prefer to do it with Visual Studio but I didn't find a way to start customizing an existing Form aspx from VS.
My suggestion... if you don't mind using Server Object Model, you could use a Visual WebPart. It's encapsulated and promotes code reusability. From there, you could include client side code, or server side code. Personally I prefer VS to do this, but if you prefer SD, here is a walkthrough https://msdn.microsoft.com/en-us/library/ee231546.aspx
And here is a link on how to include it within an application page
Add a WebPart to an Application page
Hope this helps a bit

Use Telerik converter service through WebBrowser?

I'm trying to visit the webpage http://converter.telerik.com/ using a WebBrowser control in a WinForms application but the page contains script errors.
After ScriptErrorsSuppressed to True the main controls of the webpage are unable to load at this point i'm lost about using the WebBrowser control to this task so I've search other alternatives.
I've tried with the latest build of GeckoFX (29.0.X) from here: https://bitbucket.org/geckofx/
With the GeckoWebBrowser control the Telerik page loads perfectly but after pressing the "Convert" button from my GeckoWebBrowser the second "Textbox" gets crazy and is not properly displayed, so again I'm lost but I don't know what more alternatives I have.
In the past i've tried to use some builds of chrome for .Net but I was unable to compile them.
What I need to do to use the Telerik converter service using any kind of webbrowser from my app?
PS: Dependencies are not a problem for me, I just want to develop a personal application for my only usage to load/save snippets that I converted using the Telerik service accessing to its converter webpage from my app.
Personally I would take a look at SharpDevelop's NRefactory Library and see if I could utilize this in my application instead of using someone else's webservice which more than likely uses NRefactory as it's underlying engine.
The online version of the code converter is available at http://codeconverter.sharpdevelop.net/.
https://github.com/icsharpcode/SharpDevelop/wiki/Code-Converter
https://github.com/icsharpcode/SharpDevelop/wiki/NRefactory
About NRefactory:
ICSharpCode.NRefactory is freely available as a part of SharpDevelop IDE.
It is parser library for C# and VB.
It consists of a single Abstract Syntax Tree (AST) that can represent all constructs that are available in C# or VB (unlike System.CodeDom, which only represents constructs common to C# and VB).
By using the C# parser and a VB output visitor (or vice versa), you can do a code converter.
After parsing to AST, you can analyze and/or transform the AST and re-create source code from the (modified) AST, then re-insert the comments we saved from the parser into the output
For more info about NRefactory please see: sharpdevelop.net and NRefactory wiki.
You may try samples\NRefactoryDemo in the SharpDevelop source code to take a look how the AST parse source code.
Source: http://www.codeproject.com/Articles/262950/CodeConverter

Using Silverlight with HTML?

I usually C++ applications. The only web-application development I've done is writing Java Applets. There it's all pretty simple stuff. Just write the entire applet in Java, and embed it into an html page with the:
<applet></applet> or <object></object>
tag.
Now, I am trying to find my way to Silverlight. Now Visual Web-Developer Express or Visual Studio is awesome. It eases all problems, creating a new Silverlight project automatically generates an aspx website and does all the embedding & deployment.
However, I don't want to depend on the IDE. Though I use IDEs quite often, what I hate is depending on it. So my questions are,
Is it possible to write a silverlight app with a simple programmer's editor?
How do I embed my silverlight XAML code and C-Sharp compiled *.dlls in an HTML file?
Some basic tutorial or documentation for people like me who know absolutely nothing about Silverlight?
How do I embed my silverlight XAML code and C-Sharp compiled *.dlls in an HTML file?
You can add a silverlight app to a html file simply by using the <object> tag (here is an example taken from MSDN):
<object width="300" height="300"
data="data:application/x-silverlight-2,"
type="application/x-silverlight-2" >
<param name="source" value="SilverlightApplication1.xap"/>
</object>
Is it possible to write a silverlight app with a simple programmer's editor?
It is possible to write all of your code for a silverlight app using nothing but notepad, but because of the somewhat verbose nature of XAML, i think this would be a fairly tedious task. If anything, i would suggest you go in the other direction and use Expression Blend to craft your XAML and then Visual Studio for your C# needs - the two IDE's work together very effectively and allow you to easily switch from one to the other with ease.
Some basic tutorial or documentation for people like me who know absolutely nothing about Silverlight?
If your looking for good tutorials, head over to the official silverlight site where you will find lots of tutorials, videos and hands on labs to help you through the learning process.
Here are some other good resources:
There were lots of good presentations on Silverlight at MIX10
Channel9 in general has lots of good vids. This is their Silverlight section
A list of great Silverlight resources from SmashingApps
Tekpub do a free video course on Silverlight 4
The *.xap file generated from compiling a Silverlight application is simply a zip file with a different extension. You can check out the contents of a XAP file by renaming it with a ZIP extension, then browsing through it.

Is it possible to create a desktop application whose UI is HTML rendered using ASP.NET templates without using a webserver?

I was thinking of creating a desktop application and for the user interface of the application I thought that HTML will be the best option. But I needed some way to generate the HTML for the application from the data structure that it holds.
So I was wondering if it was possible to reuse the ASP.NET engine so it renders the pages but I don't want to install a full IIS server for the users of this application.
So is that possible? Maybe not using the ASP.NET engine, maybe there is a similar one for desktop applications.
You might be able to use the UltiDev Cassini web server (http://ultidev.com/products/Cassini/) for this purpose. Its lightweight and relatively easy to use.
Are you planning to generate the HTML dynamically, or will static HTML suffice? Don't forget that you can embed the IE WebBrowser control in a desktop app, and then gain access to the DOM from the desktop app code. Lots of interesting things could be done using this approach.
Have a look at this article "ASP. NET Client-side Hosting with Cassini":
http://msdn.microsoft.com/en-us/magazine/cc188791.aspx
I would recommend 2 options:
Using c# to create a desktop app to host a Web Control. Use C# to process the data into html and feed that as a string to the webcontrol.
Use jQuery to process your data in the HTML page itself.
Adobe AIR supports something like this (build a site using HTML+javascript, but then deploy it as a web application) however it is not going to support the ASP.NET markup.
Your question is about generating the HTML, not displaying the HTML, correct?
You can use the rendering engine from ASP.NET MVC, or even one of the alternate view engines like Spark.

Categories

Resources