Skip to content

Embed a C# usercontrol in a HTML page

yusuf

Asked Nov 27, 2005, 8:24 PM EST2 answers
Share
LinkedInX

Hello Sir,
Thanks for your time.

My question is- Can we embed a usercontrol written in C# to a plain HTML page.if yes? then how.
i want to run this webpage in a TOMCAT v3.2.3 not IIS.when i try the same in IIS, its working perfectly.
Below is my code snippet-- kindly correct me and give me a solution ,thank you.

Usercontrol code -

C#
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace windows_Activex
{
public class NBuserControlTextbox : System.Windows.Forms.UserControl
{
private System.Windows.Forms.TextBox CTL_txtbox1;
private System.Windows.Forms.Button CTL_cmdClick;
private System.ComponentModel.Container components = null;
public NBuserControlTextbox()
{
InitializeComponent();
}

private void CTL_cmdClick_Click(object sender, System.EventArgs e)
{
 CTL_txtbox1.Text = "Button Clicked";
}
public static void Main(string[] args)
{MessageBox.Show("Application Started");}
}
}

HTML page

<html>
  <body>
    <center>Click the button</center>
 <object id="windows_Activex" height="250" width="300"
    classid="..newbreak/windows_Activex.dll#windows_Activex.NBuserControlTextbox">
      </object>
  <body>
</html>

THats abt it.

i would be grateful if u can give me an solution to this...
Thanks!

Yusuf

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    The control needs the server to generate its interface and as far as I know IIS is the only server at the moment that fully supports .NET controls and the CLR

    0
  • 0
    hi,thanks for ur reply.
    How to generate the interface by the server?
    can u give me the code snippet.
    Does Tomcat 3.2.3 support the same.
    Thanks,
    yusuf
    0