Groups | Blog | Home
all groups > asp.net building controls > march 2005 >

asp.net building controls : Embedded dll in html page


Andrew
3/3/2005 9:25:02 AM
Hi,

I've tried creating a very basic class library. It has one object and one
property. The property returns always the same string value. I then use the
<OBJECT> tag to embed the dll in my page. The dll and html sit in a root
directory on my IIS 6 server. Code is below:

namespace ClassLibrary1
{
public class myObject
{
public myObject()
{
}

public String AValue
{
get
{
return "hello";
}
}
}
}

The html code is as follows:

<html>
<body color=white>
<hr>
<OBJECT id="myControl1" name="myControl1"
classid="ClassLibrary1.dll#ClassLibrary1.myObject">
</OBJECT>
<INPUT id=TxtBox>
<script language="vbscript">
TxtBox.value = myControl1.AValue
</script>

<hr>
</body>
</html>

The html page returns the error "Object doesn’t support this property or
method".

I hope you can help - I must be missing something but I'm surely stuck!


Andrew
recoil NO[at]SPAM community.nospam
3/5/2005 5:27:09 AM
Object does not support this property opr method usually means that the
object very well could be null. Is the Custom Control actually showing
up on the web page.

If the object is a non-visual object then you should do the following.

Do yourself a favor and before the TxtBox.value = myControl put a
if myControl1 is null then msgbox "object is null and dll is not loaded"
AddThis Social Bookmark Button