RaiseEvent in VB

C

Carl tam

Hi everyone,
I got a quite interesting problem myself and got stuck.
I have an aspx page with a windows user control with it.

in the Windows Control. I have a RaiseEvent statement,
say OnClearAlarm, and tell the computer to RaiseEvent when
I click on the Panel.

in the webpage, I first load the user control, and then
have a javascript function to handle the event:
Form1.ClickMe::OnClearAlarm(), and inside the function, I
just call a new window for testing.

But somehow it just won't work correctly. Can someone
help me out here.

Carl

Code for Windows UserControl:
Public Event OnClearAlarm()

Private Sub Panel1_Click(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Panel1.Click
RaiseEvent OnClearAlarm()
End Sub

Code for Web Page:
<form id="Form1" method="post" runat="server">
<OBJECT id="ClickMe" height="350" width="350"
classid="ClickMe.dll#ClickMe.UserControl1"
VIEWASTEXT></OBJECT>
<script language =javascript>
function
Form1.ClickMe::OnClearAlarm() {
alert("fggh");
newWindow = window.open
('MasterDetail.aspx');
newWindow.focus()
}
</script>
</form>
 
H

Herfried K. Wagner [MVP]

* "Carl tam said:
I got a quite interesting problem myself and got stuck.
I have an aspx page with a windows user control with it.

in the Windows Control. I have a RaiseEvent statement,
say OnClearAlarm, and tell the computer to RaiseEvent when
I click on the Panel.

in the webpage, I first load the user control, and then
have a javascript function to handle the event:
Form1.ClickMe::OnClearAlarm(), and inside the function, I
just call a new window for testing.

But somehow it just won't work correctly. Can someone
help me out here.

Seems to be a JavaScript problem, you will more likely get an answer
here:

<
Web interface:

<http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.aspnet>
 
C

Carl Tam

Never Mind, everyone..
I found the solution of this problem. this is because the
dll must has a COM GUID inside of it in order for the dll
actually send the event to the client side to the
javascript. so instead of using usercontrol.vb, we would
have to add a new item under COM Class, from there, you
will need to copy the COM GUID (with the unique code
generated by the CLR) and the Declaration of the COM Class
(which is the first statement) into the usercontrol. then
compile it... there I can raise the event.. ^_^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top