Client-side scripting on server control

  • Thread starter Thread starter Mantorok
  • Start date Start date
M

Mantorok

Hi all

Is it possible to have client-side scripts executed from server controls, I
have a BulletList control and when they click on an item in the list I need
some javascript to be executed.

Thanks
Kev
 
Eliyahu Goldin said:
Kev,

You need to attach client-side events to the control. You need to
understand
what HTML elements the control renders as and how to get to the elements
from server code.

Do you have any examples or guidance for me on achieving that?

Thanks
Kev
 
re:
it's a v2.0 control.

Is it ? I can't find it in my 2.0 documentation,
nor on the online msdn2 docs. Would you post an online reference ?

I know it's a Display mode for the <asp:ValidationSummary control :
DisplayMode="BulletList | List ( but that works in v 1.1, too )
or, more properly, it's one of the Members of the DisplayMode
Enumeration ( the others are "List" and "SingleParagraph ).

I thought it could be a control which Dino Esposito authored :
http://www.code-magazine.com/article.aspx?quickid=0309051&page=2




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
Aha, thank you, i'll give that a go.

Kev

Eliyahu Goldin said:
Look at Attributes property. You need to know what client event you want
to
handle and set the attribute for this event to the name of a javascript
function that will handle it.:

myList.Attributes["<client event>"]="handleTheEvent();";

Again, you need to find out what html tag the BulletedList is rendered as
and what event you need to handle for this tag.

Eliyahu

Mantorok said:
No, it's a v2.0 control.

Kev
 
Juan T. Llibre said:
re:

Is it ? I can't find it in my 2.0 documentation,
nor on the online msdn2 docs. Would you post an online reference ?

I know it's a Display mode for the <asp:ValidationSummary control :
DisplayMode="BulletList | List ( but that works in v 1.1, too )
or, more properly, it's one of the Members of the DisplayMode
Enumeration ( the others are "List" and "SingleParagraph ).

I thought it could be a control which Dino Esposito authored :
http://www.code-magazine.com/article.aspx?quickid=0309051&page=2

Oops, I meant BulletedList....

Kev
 
Kev,

You need to attach client-side events to the control. You need to understand
what HTML elements the control renders as and how to get to the elements
from server code.

Eliyahu
 
Ahh, the mystery unravels!
I was scratching my head on that one... ;-)



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 
Look at Attributes property. You need to know what client event you want to
handle and set the attribute for this event to the name of a javascript
function that will handle it.:

myList.Attributes["<client event>"]="handleTheEvent();";

Again, you need to find out what html tag the BulletedList is rendered as
and what event you need to handle for this tag.

Eliyahu
 

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

Back
Top