By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,341 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,341 IT Pros & Developers. It's quick & easy.

RaiseEvent in VB

P: n/a
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>
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* "Carl tam" <ct**@ase-usa.net> scripsit:
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:

<news://msnews.microsoft.com/microsoft.public.dotnet.framework.aspnet>

Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.aspnet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
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.. ^_^

-----Original Message-----
* "Carl tam" <ct**@ase-usa.net> scripsit:
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 answerhere:

<news://msnews.microsoft.com/microsof...c.dotnet.frame work.aspnet>
Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp? url=/newsgroups/loadframes.asp?
icp=msdn&slcid=us&newsgroup=microsoft.public.dotne t.framewo
rk.aspnet>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.