what I learn is what u c

Posts Tagged ‘javascript

Call Javascript Function inside asp:Hyperlink Control

with 8 comments

If you ever want to call a javascript function (with or without  parameter) from a server side hyperlink control here it is..

Step 1 :

declare your javascript function between

Step 2:

<asp:HyperLink ID=”hypCate” runat=”server”

NavigateUrl='<%# “javascript:showPopUp(” & DataBinder.Eval(Container.DataItem, “ID”) & “);” %>’

Text='<%#DataBinder.Eval(Container.DataItem, “Name”)%>’ />

Carefully follow the single and double quotes for NavigateUrl attribute.

Needless to say showPopUp is the name of Javascript Function.

It displays the NAME as hyperlink. Clicking that calls javascript showPopUp.

Written by gchandra

September 27, 2007 at 4:55 pm