Page view counter
HomeLearnVideosHow Do I: Add JavaScript Event Handlers to ASP.NET Server Controls  

How Do I: Add JavaScript Event Handlers to ASP.NET Server Controls

In this video Chris Pels will show how to interface JavaScript methods with ASP.NET server controls to provide client side functionality for the server controls. First, see how to add client event handlers declaratively by extending ASP.NET server controls with custom attributes. Next, see how to add attributes for mapping client methods to ASP.NET server controls programmatically which offers the advantage of being done at runtime. Finally, learn how to reference the ID of a server control, which is rendered dynamically by ASP.NET, in JavaScript code.

Presented by Chris Pels

Duration: 18 minutes, 15 seconds

Date: 20 March 2008

Watch the video   |   Download the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 21

Leave a Comment

Dollarjunkie : On March 22, 2008 4:44 PM said:

Great Video. I hope we have more and more of these as some of us are not as good as we would like to be when it comes to client side server side interaction.

Rene Drescher-Hackel : On March 23, 2008 2:06 PM said:

Was in dieser Darstellung leider fehlt ist die Cross-Browser-Kompatibilität und der Fall, wenn Javascript in externen Javascript-Dateien organisiert ist, was ja immer zu empfehlen ist.

Hier ist ein Ansatz im LoadComplete-Event der Seite alle relevantene Controls in einem Clientobject zusammen zufassen, wobei sich JSON als Datenaustauschformat anbietet.

Einen einfachen Lösungsgedanken habe ich mal unter www.drescher-hackel.de/default,date,2007-07-22.aspx">www.drescher-hackel.de/default,date,2007-07-22.aspx versucht darzustellen.

Neben der ClientID kann man hier auch weitergehende Funktionalität unterbringen und sich so die Arbeit etwas erleichtern.

-------- translation by google service -------------

What happened in this presentation is sadly lacking cross-browser compatibility, and the case where JavaScript in external JavaScript files organized, which is always recommended.

Here is an approach Load Complete event of the page all relevantene Controls in a client Object zufassen together, with JSON as the data exchange format offers.

A simple solution, I thought at times www.drescher-hackel.de/default, date ,2007-07-22. Aspx seeks to demonstrate.

Besides the ClientID can also accommodate additional functionality, and so the work somewhat easier.

faisalzshah : On March 24, 2008 9:29 AM said:

amazing video

brentlamborn : On March 24, 2008 2:56 PM said:

I didn't know about window.event.srcElement ! Thanks!

scottt40 : On March 24, 2008 5:48 PM said:

Nice job!

As a non-Javascripter, that helped me to understand quite a bit of how javascript can work with asp.net controls on a page. Thanks

BrianOConnell : On March 25, 2008 1:45 AM said:

Good video but be careful with srcelement. It is IE only. Microsoft need to start reading quirksmode.org and as has been said above eventually they need to start encouraging people to use external .js files only.

gokul_4580 : On March 25, 2008 8:34 AM said:

Learnt few new things today. Good one. Thanks a lot Chris.

zhao_hui_xi@hotmail.com : On March 26, 2008 2:27 AM said:

Thanks

PragatPatel : On March 28, 2008 3:01 AM said:

If I want to call any server side method from Javascript, Can I do this? Property I understood but what about method.

satishnarni : On April 02, 2008 1:18 AM said:

u realy helped me

good2great : On April 02, 2008 5:22 PM said:

it's not so good

good2great : On April 02, 2008 5:23 PM said:

What happened in this presentation is sadly lacking cross-browser compatibility, and the case where JavaScript in external JavaScript files organized, which is always recommended.

Here is an approach Load Complete event of the page all relevantene Controls in a client Object zufassen together, with JSON as the data exchange format offers.

A simple solution, I thought at times ... Aspx seeks to demonstrate.

Besides the ClientID can also accommodate additional functionality, and so the work somewhat easier.

randomaccess : On April 07, 2008 7:17 PM said:

Hi,

Why not just post a simple written tutorial? Why waste 18mins of my life watching a video reference that would be far simpler to digest as written text, and would only take about 3mins to read? I find these video tutorials intensely boring and annoying, to the point that whilst I'm very interested in this topic, I am not going to watch this video.

Please release a detailed written tutorial on this very important topic.

Do you really think ASP.NET programmers are so stupid that they must be read to like a child?

Video tutorials are ideal for: Photoshop, Blend, 3D Studio, i.e. *visual* software. *Programming* does not suit video tutorials. Sorry.

/Serializer

JoeStagner : On April 14, 2008 8:17 PM said:

That's pretty harsh.

Different people prefer to learn in different ways.

As you can read above many, many people really like the short video style.

So, based on our download numbers .....

How-Do-I Videos

30,000,000 - In favor.

1 - Opposed

:)

maryraj : On April 22, 2008 1:34 PM said:

Hi

randomaccess,

These videos are only for beginners,not for experienced people.Beginners really enjoy these videos.

muhammed : On August 07, 2008 12:39 AM said:

thanks

cv_vikram : On August 09, 2008 8:37 AM said:

tfs.....

xjpmauricio : On August 26, 2008 6:57 AM said:

Why not create categorized sections of these video tutorials? something as simple as "Begginer" and "Advanced"?

chocolim : On October 14, 2008 10:34 AM said:

30.000.000 vs 2

I dont like it either, but i just go to another seccion in this site that not have video in the url, maybe that can help you, if you dont like videos dont look the video seccion

djibril_chimere_DIAW : On October 29, 2008 7:15 PM said:

Thanks! Jërëjëf!

djafer : On November 12, 2008 1:44 AM said:

Teşekkürler

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Microsoft Communities