How to use WinControl in ASP.Net

//Create Windows User Control with this Code//

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace BEST
{
public partial class Main : UserControl
{
string _Title = "";
public Main()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this.Title, "Msg", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public string Title
{
get { return _Title; }
set { _Title = value; }
}
}
}

//Designer Code//*************************************************

namespace BEST
{
partial class Main
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///

/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.test = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// test
//
this.test.Location = new System.Drawing.Point(64, 65);
this.test.Name = "test";
this.test.Size = new System.Drawing.Size(75, 23);
this.test.TabIndex = 0;
this.test.Text = "button1";
this.test.UseVisualStyleBackColor = true;
this.test.Click += new System.EventHandler(this.button1_Click);
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.test);
this.Name = "Main";
this.Size = new System.Drawing.Size(206, 132);
this.Load += new System.EventHandler(this.UserControl1_Load);
this.Click += new System.EventHandler(this.Main_Click);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Main_Paint);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button test;
}
}

//Add below code under body tag of Your web page//

//Remember in the classid section after # is Namespace and your control name is the case sensative//

<object classid="BEST.dll#BEST.Main" style="width: 352px; height: 224px">
<param name="Title" value="Deepak Jain" />
</object>


//Also you can use this object in any td of page table and alsoe param is the parameter that send from your page//

//Also you can use this

No comments: