Smart Client (WinForm) does not render in Browser (IE)

G

Guest

The following code is intended to display a winform (DateTimePicker Control)
in a browser. But, when the aspx page that contains the reference to the
winform in the object tag is run, all that is displayed is a blank
placeholder and not the control. Any ideas or help is appreciated!

DateTimePicker.cs WinForm control code - output type class library
===========================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Windows.Control.Library
{
/// <summary>
/// Summary description for DateTimePicker.
/// </summary>
public class DateTimePicker : System.Windows.Forms.Form
{
private System.Windows.Forms.DateTimePicker dateTimePicker1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public DateTimePicker()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(40, 40);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// DateTimePicker
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.dateTimePicker1);
this.Name = "DateTimePicker";
this.Text = "DateTimePicker";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new DateTimePicker());
}

}
}



ASPX PAGE CODE
======================
<%@ Page language="c#" Codebehind="UseWinControl.aspx.cs"
AutoEventWireup="false" Inherits="web.playground.UseWinControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head>
<title>UseWinControl</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<OBJECT id=WinControl2
classid=http:Windows.Control.Library.dll#Windows.Control.Library.DateTimePicker
height=500 width=200
VIEWASTEXT></OBJECT>

</form>

</body>
</html>
 
N

Norman Yuan

1. I think what you are taiking is not Smart Client.
2. You can embed Win Form CONTROL (or derived/customized CONTROL) in web
page (suppose the client computer has .NET framework installed), but NOT a
Win Form (or derived Form).

Chris Fink said:
The following code is intended to display a winform (DateTimePicker Control)
in a browser. But, when the aspx page that contains the reference to the
winform in the object tag is run, all that is displayed is a blank
placeholder and not the control. Any ideas or help is appreciated!

DateTimePicker.cs WinForm control code - output type class library
===========================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Windows.Control.Library
{
/// <summary>
/// Summary description for DateTimePicker.
/// </summary>
public class DateTimePicker : System.Windows.Forms.Form
{
private System.Windows.Forms.DateTimePicker dateTimePicker1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public DateTimePicker()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(40, 40);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// DateTimePicker
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.dateTimePicker1);
this.Name = "DateTimePicker";
this.Text = "DateTimePicker";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new DateTimePicker());
}

}
}



ASPX PAGE CODE
======================
<%@ Page language="c#" Codebehind="UseWinControl.aspx.cs"
AutoEventWireup="false" Inherits="web.playground.UseWinControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head>
<title>UseWinControl</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<OBJECT id=WinControl2
classid=http:Windows.Control.Library.dll#Windows.Control.Library.DateTimePic
ker
height=500 width=200
VIEWASTEXT></OBJECT>

</form>

</body>
</html>
 
G

Guest

Hi Norman,

Thanks for the response. Perhaps I am confused as to what I can and can't
do in a browser as a "smart client". In the example, the writer claims to be
able to place a DateTimePicker control on a webpage, which is what I am
attempting to do.

http://www.codeguru.com/columns/VB/article.php/c7463/

What are examples/differences between a win form and a win form control and
what allows one to be placed into a web page over the other?

Chris

Norman Yuan said:
1. I think what you are taiking is not Smart Client.
2. You can embed Win Form CONTROL (or derived/customized CONTROL) in web
page (suppose the client computer has .NET framework installed), but NOT a
Win Form (or derived Form).

Chris Fink said:
The following code is intended to display a winform (DateTimePicker Control)
in a browser. But, when the aspx page that contains the reference to the
winform in the object tag is run, all that is displayed is a blank
placeholder and not the control. Any ideas or help is appreciated!

DateTimePicker.cs WinForm control code - output type class library
===========================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Windows.Control.Library
{
/// <summary>
/// Summary description for DateTimePicker.
/// </summary>
public class DateTimePicker : System.Windows.Forms.Form
{
private System.Windows.Forms.DateTimePicker dateTimePicker1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public DateTimePicker()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(40, 40);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// DateTimePicker
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.dateTimePicker1);
this.Name = "DateTimePicker";
this.Text = "DateTimePicker";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new DateTimePicker());
}

}
}



ASPX PAGE CODE
======================
<%@ Page language="c#" Codebehind="UseWinControl.aspx.cs"
AutoEventWireup="false" Inherits="web.playground.UseWinControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head>
<title>UseWinControl</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<OBJECT id=WinControl2
classid=http:Windows.Control.Library.dll#Windows.Control.Library.DateTimePic
ker
height=500 width=200
VIEWASTEXT></OBJECT>

</form>

</body>
</html>
 
N

Norman Yuan

The major part of that article is about using Win Form CONTROLs in web page
(or web app). It is not SMART CLIENT app. As my previous reply, you use Win
Form Control in web page, not Win Form. If you take look the picture in that
article, the author created an Window User Control project and wrap up the
DateTime Picker in a Windows User Control library (i.e. the Control is a
control, not a Win Form). To do that simply start VS and create a Windows
Control Library project and then go ahead to create your control(s).

Although you can use Win Form control in web app, in general it is not a
good choice unless your web app runs under tightly controlled enveronment
(intranet, and security is not a concern... and so on). That is why the
author of that article went on to mention SMART CLIENT, which is Win Form
app, BTW.

Chris Fink said:
Hi Norman,

Thanks for the response. Perhaps I am confused as to what I can and can't
do in a browser as a "smart client". In the example, the writer claims to be
able to place a DateTimePicker control on a webpage, which is what I am
attempting to do.

http://www.codeguru.com/columns/VB/article.php/c7463/

What are examples/differences between a win form and a win form control and
what allows one to be placed into a web page over the other?

Chris

Norman Yuan said:
1. I think what you are taiking is not Smart Client.
2. You can embed Win Form CONTROL (or derived/customized CONTROL) in web
page (suppose the client computer has .NET framework installed), but NOT a
Win Form (or derived Form).

Chris Fink said:
The following code is intended to display a winform (DateTimePicker Control)
in a browser. But, when the aspx page that contains the reference to the
winform in the object tag is run, all that is displayed is a blank
placeholder and not the control. Any ideas or help is appreciated!

DateTimePicker.cs WinForm control code - output type class library
===========================================
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Windows.Control.Library
{
/// <summary>
/// Summary description for DateTimePicker.
/// </summary>
public class DateTimePicker : System.Windows.Forms.Form
{
private System.Windows.Forms.DateTimePicker dateTimePicker1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public DateTimePicker()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(40, 40);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// DateTimePicker
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.dateTimePicker1);
this.Name = "DateTimePicker";
this.Text = "DateTimePicker";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new DateTimePicker());
}

}
}



ASPX PAGE CODE
======================
<%@ Page language="c#" Codebehind="UseWinControl.aspx.cs"
AutoEventWireup="false" Inherits="web.playground.UseWinControl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
<head>
<title>UseWinControl</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<OBJECT id=WinControl2
classid=http:Windows.Control.Library.dll#Windows.Control.Library.DateTimePic
ker
height=500 width=200
VIEWASTEXT></OBJECT>

</form>

</body>
</html>
 
R

Remigiusz Samosiuk

Norman said:
The major part of that article is about using Win Form CONTROLs in web page
(or web app). It is not SMART CLIENT app. As my previous reply, you use Win
Form Control in web page, not Win Form. If you take look the picture in that
article, the author created an Window User Control project and wrap up the
DateTime Picker in a Windows User Control library (i.e. the Control is a
control, not a Win Form). To do that simply start VS and create a Windows
Control Library project and then go ahead to create your control(s).

Although you can use Win Form control in web app, in general it is not a
good choice unless your web app runs under tightly controlled enveronment
(intranet, and security is not a concern... and so on). That is why the
author of that article went on to mention SMART CLIENT, which is Win Form
app, BTW.

I Agree here, but as you can see in my earlier post (UserControl hosted
in IE and Control.Invoke) there are problems with background processing
when you host control in IE. If I will be able to use form instead, I
will not have such problems (because hosted control is treated as ActiveX).
But probably it will not be a problem with simple controls like
DateTimePicker.

BTW. Beware of SecurityException !!! :) It will be your curse when you
start to do controls hosted in IE

Remi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top