Problem With User Control

B

batista

Hi,

I have created a user control in C#,and using it in one of my webpages.

Now, i want to do something like this:

call a function from user control(dll), but which is implemented in
the webpage's .cs or webpage's javascript(events).
Something like event handling.

Note: I wanted to create an ActiveX Control, i found out that user
control are used instead in .net.

Any suggestions on how to do it?

Bye.
 
G

Guest

Do just that - implement event handling in your control.

type "event" anywhere in the code, press F1 and read the example.
 
B

batista

thnks for reply.

i did that.

sort of pseudo code

class A
{
public delegate void aa();
public static event aa aaevent;

public func()
{
aaevent(); //i'm getting an exception here that object is set to
null.
}

}

now i used this dll in my webpage with object tag.

then i wrote this in javascript:

<SCRIPT lang="javascript">
function CallIt() //this is called on button click
{
var objAct = document.getElementById"myclassA");
objAct.func();
}

</SCRIPT>

<SCRIPT lang="javascript" event="aaevent()" for="myclassA">

alert("It is the Event of ActX Control");
</SCRIPT>



So why is it happening?
 
G

Guest

batista,

Why do you need static event in an instance User control?

and unless the client (your web page that uses the control) has hooked up to
the event, your event reference will be null, so you will have to check it in
your code before calling the event:

if (aaaevent != null)
aaevent();

HTH
 
G

Guest

batista,

my bad - should have read the whole message. I am not sure whether you can
hookup to the SERVER user controls from the CLIENT-side script. My
understanding is that you cannot do that (I may be wrong though).

As I have never done anything like that - you may need to re-post your
question so that others may be able to help you. When you do that, try to
soecify exactly what you need - or what you are trying to achieve.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top