HTML page in Visual Studio LightSwitch


HTML is Hyper Text Markup Language, which is used for creating web pages. If you want to create a web page in LightSwitch application, you can do it.

Step by step solution

Step 1 : Open Visual Studio LightSwitch->Right click on screen->Add new screen.

1st.gif

Step 2 : Select new data screen->Write screen name (WebPage) ->Ok.

2nd.gif

Step 3 : Now add data item->Select local property->Type (String)->Ok.

3rd.gif

Step 4 : Move prpWebPage from screen to screen commandBar.

4th.gif

Step 5 : Go to prpWebPage property->Click change custom control.

5th.gif

Step 6 : Now select WebBrowser->Ok.

6th.gif

Step 7 : Go to .cs page of prpWebPage screen then write the following code.

using
System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
    public partial class WebPage
    {
        private void webControlAvailable(object sender, ControlAvailableEventArgs e)
        {
            string strHtml = "<h1>Hello World!</h1>";
            ((System.Windows.Controls.WebBrowser)e.Control).NavigateToString(strHtml);
        } 
    }
}

Step 8 : Run application (Press F5).

7th.gif

Up Next
Ebook Download
View all
Learn
View all
NA 10.7k4.2m

Vineet Kumar Saini is MCA qualified with Honors from SunderDeep Engineering College Ghaziabad. Currently he is working as a "WEB Developer" ... Know more

http://vineetsaini.wordpress.com/