I created a windows form user control dll. The control has a button and and a picturebox. I added it to my .aspx page using this:
<object id="MyWinControl1" height="200" classid="http:WindowsFormsControlLibrary1.dll#WindowsFormsControlLibrary1.UserControl1" VIEWASTEXT> </object>
I put it in between my body tag.
In design view I get this error:
a control type was not specified or the specified type could not be found
What am I doing wrong? Do I need to put more information?
[OPs Answer moved to here]
This is my code:
UserControl1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsControlLibrary1
{
[ComVisible(true)]
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
public void SendMessage(string msg)
{
lblMessage.Text = msg;
}
}
}
HTMLPage1.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Windows Form Control Test Page</title>
<script type="text/javascript">
function SendMessageToWinControl() {
var winCtrl = document.getElementById("MyWinControl");
winCtrl.SendMessage("Message sent from the HTML page!!");
}
</script>
</head>
<body>
<h1>Windows Form Control:</h1>
<object id="MyWinControl" classid="http:WindowsControlLibrary1.dll#WindowsControlLibrary1.UserControl1"
height="100" width="300" VIEWASTEXT/>
<br/><br/>
<input type="button" onclick="SendMessageToWinControl()" value="Send Message" />
</body>
</html>
When I look at the HTMLPage1.htm in design view. Where it is suppose to show the control it says:
a control type was not specified or the specified type could not be found
and i don't see the button that is suppose to show.
When I view HTMLPage1.htm in the browser I see a red X where my control is suppose to be at. And I don't see the button that is suppose to show.