.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 2nd, 2004, 11:07 PM
dmullen99 dmullen99 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 dmullen99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question vb.net usercontrol in web page

I need to have a .net usercontrol based on some code I have to work with a serial port to run within a web form, accepting input through a method and raising an event which will call a javascript event handler within the page.

As a start I was just going to write a simple one that displays a message box and works with a javascript event handler. I can get the control to display properly and calling the methods for the control work just fine but I can't get events to work with the javascript event handler. In my latest iteration I've tried using the ComClassAttribute and a funny thing happened. Just for the heck of it I tried using the clsid:<guid> for the classid instead of the normal syntax for a .NET control and it worked. But not a real good solution for deploying it, especially when I know other people are getting it to work without doing that. I've also enabled full authority for both the assembly as well as put the site in my trusted sites and enabled full authority for trusted sites. I'm going nuts here.

Thanks in advance,

Dave



Here's my code for my control:

Code:
 
<ComClass(DeviceController.ClassId, DeviceController.InterfaceId, DeviceController.EventsId)> _
Public Class DeviceController
#Region "COM GUIDs"
	' These  GUIDs provide the COM identity for this class 
	' and its COM interfaces. If you change them, existing 
	' clients will no longer be able to access the class.
	Public Const ClassId As String = "F2BCEC96-E846-4B47-8EBF-2E84A3E97AA4"
	Public Const InterfaceId As String = "8B0D4B7B-21CB-41FB-8BD2-55465C3CE94B"
	Public Const EventsId As String = "6F0C0CC3-1F08-43A5-B406-89E6FF739FD2"
#End Region
	' A creatable COM class must have a Public Sub New() 
	' with no parameters, otherwise, the class will not be 
	' registered in the COM registry and cannot be created 
	' via CreateObject.
	Public Sub New()
		MyBase.New()
	End Sub
	Public Sub SomeSub()
		MsgBox("SomeSub")
	End Sub
	Public Sub RaiseDataReceived()
		RaiseEvent DataReceived()
	End Sub
	Public Event DataReceived() 
End Class


and the code on my webform:

Code:
 
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="EclipseWeb.WebForm1"%>
<html>
  <head>
	<title>WebForm1</title>
	<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
	<meta name=vs_defaultClientScript content="JavaScript">
	<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
	<script for="userControl11" event="DataReceived" language="javascript">
  alert("Hello!");
	</script>
  </head>
  <body MS_POSITIONING="GridLayout">
 
	<form id="Form1" method="post" runat="server">
<object id="userControl11" classid="EclipseDevCtl.dll#EclipseDevCtl.DeviceController" VIEWASTEXT>
</object>
<br><br>
 <button id=btnTest2 onclick="document.all.userControl11.SomeSub()">Click Me</button>
	 <br>
 <button id=btnTest3 onclick="document.all.userControl11.RaiseDataReceived()">Click Me 2</button><br><br>
	</form>
  </body>
</html>

Reply With Quote
  #2  
Old December 2nd, 2004, 11:08 PM
dmullen99 dmullen99 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 dmullen99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
one thing to add. in this last version I tried it without inheriting from UserControl so technically it's not a UserControl

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > vb.net usercontrol in web page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT