Using Windows Control in ASP.NET

C

Chung

Hi

I am trying to create a Web applicatiion by using windows
user control. I am having problem when I trying to load
the web page, I got blank screen with a broken image. It
is like the web page trying to load an image but the file
is not in the Folder.

I have set the Execute Permissions to Scipts only in IIS.
I have also checked the index.html and Win_Ctrl_Lib.dll
are in the same folder. Then Namespace and the control
method is correct too.

Is anyone can help me?

Regards,
Chung


Here is my code


HTML Code index.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" >
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft
Visual Studio 7.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<OBJECT id="UserControl1"
classid="Win_Ctrl_Lib.dll#Win_Ctrl_Lib.UserControl1"
width="800" height="600" style="font-size:12;" VIEWASTEXT>
</OBJECT>
</BODY>
</HTML>


c# Window Control Win_Ctrl_Lib.dll:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

using System.Diagnostics;


namespace Win_Ctrl_Lib
{
/// <summary>
/// Summary description for UserControl1.
/// </summary>
public class UserControl1 :
System.Windows.Forms.UserControl
{
private System.Windows.Forms.TextBox
S_tb;
private System.Windows.Forms.Button
Encrypt_btn;

/// Required designer variable.
private System.ComponentModel.Container
components = null;

public UserControl1()
{
// This call is required by the
Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization
after the InitForm 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 Component 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.S_tb = new
System.Windows.Forms.TextBox();
this.Encrypt_btn = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
// S_tb
//
this.S_tb.Location = new
System.Drawing.Point(10, 10);
this.S_tb.Multiline = true;
this.S_tb.Name = "S_tb";
this.S_tb.Size = new
System.Drawing.Size(256, 50);
this.S_tb.TabIndex = 0;
this.S_tb.Text = "S:";
//
// Encrypt_btn
//
this.Encrypt_btn.Location = new
System.Drawing.Point(304, 16);
this.Encrypt_btn.Name
= "Encrypt_btn";
this.Encrypt_btn.Size = new
System.Drawing.Size(76, 21);
this.Encrypt_btn.TabIndex = 2;
this.Encrypt_btn.Text = "Go";
this.Encrypt_btn.Click += new
System.EventHandler(this.Encrypt_btn_Click);
//
// UserControl1
//
this.BackColor =
System.Drawing.Color.White;
this.Controls.AddRange(new
System.Windows.Forms.Control[] {


this.S_tb,


this.Encrypt_btn});
this.Name = "UserControl1";
this.Size = new System.Drawing.Size
(600, 300);
this.ResumeLayout(false);

}
#endregion

private void Encrypt_btn_Click(object
sender, System.EventArgs e)
{
S_tb.Text = "Button Clicked";
}
}
}
 
S

Steve C. Orr [MVP, MCSD]

Here are some links that should be able to give you some guidance:
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx
http://msdn.microsoft.com/msdnmag/issues/02/06/Rich/default.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



Chung said:
Hi

I am trying to create a Web applicatiion by using windows
user control. I am having problem when I trying to load
the web page, I got blank screen with a broken image. It
is like the web page trying to load an image but the file
is not in the Folder.

I have set the Execute Permissions to Scipts only in IIS.
I have also checked the index.html and Win_Ctrl_Lib.dll
are in the same folder. Then Namespace and the control
method is correct too.

Is anyone can help me?

Regards,
Chung


Here is my code


HTML Code index.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" >
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft
Visual Studio 7.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<OBJECT id="UserControl1"
classid="Win_Ctrl_Lib.dll#Win_Ctrl_Lib.UserControl1"
width="800" height="600" style="font-size:12;" VIEWASTEXT>
</OBJECT>
</BODY>
</HTML>


c# Window Control Win_Ctrl_Lib.dll:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

using System.Diagnostics;


namespace Win_Ctrl_Lib
{
/// <summary>
/// Summary description for UserControl1.
/// </summary>
public class UserControl1 :
System.Windows.Forms.UserControl
{
private System.Windows.Forms.TextBox
S_tb;
private System.Windows.Forms.Button
Encrypt_btn;

/// Required designer variable.
private System.ComponentModel.Container
components = null;

public UserControl1()
{
// This call is required by the
Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization
after the InitForm 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 Component 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.S_tb = new
System.Windows.Forms.TextBox();
this.Encrypt_btn = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
// S_tb
//
this.S_tb.Location = new
System.Drawing.Point(10, 10);
this.S_tb.Multiline = true;
this.S_tb.Name = "S_tb";
this.S_tb.Size = new
System.Drawing.Size(256, 50);
this.S_tb.TabIndex = 0;
this.S_tb.Text = "S:";
//
// Encrypt_btn
//
this.Encrypt_btn.Location = new
System.Drawing.Point(304, 16);
this.Encrypt_btn.Name
= "Encrypt_btn";
this.Encrypt_btn.Size = new
System.Drawing.Size(76, 21);
this.Encrypt_btn.TabIndex = 2;
this.Encrypt_btn.Text = "Go";
this.Encrypt_btn.Click += new
System.EventHandler(this.Encrypt_btn_Click);
//
// UserControl1
//
this.BackColor =
System.Drawing.Color.White;
this.Controls.AddRange(new
System.Windows.Forms.Control[] {


this.S_tb,


this.Encrypt_btn});
this.Name = "UserControl1";
this.Size = new System.Drawing.Size
(600, 300);
this.ResumeLayout(false);

}
#endregion

private void Encrypt_btn_Click(object
sender, System.EventArgs e)
{
S_tb.Text = "Button Clicked";
}
}
}
 
Joined
May 15, 2008
Messages
1
Reaction score
0
Windows Controls

Chung,

Did you ever get this problem addressed? I ask because I'm stumped on the same thing.

Thanks,

Danny
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top