MS Studio Events (Newbie)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

As I'm recently learned that creating events and handling them in web app.
is not easy as it is in Windows programing,

I want to know how to create an event handler, say for Image1, onmouseover.
In the property page For the Image1 server-object all I can see is limited
numbers of events for Image1 object (such as:DataBÄ°nding, Init, Load,
PreRender, Unload), all of their purpose are well self-defined, but none of
them are for my use. If I plan to add javascript to the HTML tag of
application, on code editor all I see is basic client objects and events for
them, so it means there is no object -specific event-handler. If I add
"onmouseover" for the "document" object it gets triggered when I move over
any controls not only for Image1.

How am I supposed to create an event-handler(onmouseover) just only for
Image1 object.

Thnx,
Tanju OZGUR
 
Hello,

If you are using Visual Studio, then first place an image control on
the asp.net form. Then select this control, and go to the properties
pane. Locate a yellow icon towards the top (looks like a lightening
bolt) and click it. It should now show you a list of all the events
available for this control. Locate onmouseover and double-click the
space where a value is supposed to go. The IDE will automatically
create a method in the codebehind where you can put the Onmouseover
code.

However, you must also enable postback for this control for it to cause
a postback on that event.

Having said that, i can't imagine a scenario where you want server-side
code executed on a onmouseover event.

- V
 
I'm doing EXACTLY what you described, but after clicking at "thunder bolt"
there are no events other than (DataBinding, Init, Load, PreRender, Unload),
so where is that "onmouseover" handler that MS Studio automatically creates?

BTW, I'm dubious about MS Studio version, Is this feature supported in (MS
Studio 2002 Version 7.0.9466; Microsoft .NET Framework 1.0 Version 1.0.3705)
 
it should be supported.

Do you have the control selected on the page? Also, are you using the
Html Image or a Server side Image Control?

- Vaibhav
 
Hi again,
Do you have the control selected on the page?
SURELY :)
Also, are you using the Html Image or a Server side Image Control?
I'm using the server side controls (either by double clicking or dragging
it) otherwise the editor won't even allow to write before I make "Run as
Server -object" .

thnx for trying to help me,

Best Regards,
 
Ok try this:

in your Page_Load event handler (in the code-behind), add an event
handler manually.

it would be something along the lines of:
imagecontrolname.eventName += new EventHandler(eventhandlername);

then you can implement the eventhandlername function.

- V
 
well I have tried it beforehand,

but as you can not specify to which event( in Image1.???????, "onmouseover"
is not a choise in the drop-down list ) I have to tie my own created event
-handler it will never be triggered. I mean that control is not aware whether
the mouse is over it or not.
 
Back
Top