Hi,For one of my projects I am displaying hyperlinks in the xamwebgrid.I am doing this using the hyperlinkbutton control using TemplateColumns. The hyperlinks are displaying fine, but I have a requirement where in I need to call javascript function when I click on the hyperlink.For example I need to be able to execute BLOCKED SCRIPTwindow.open('xyz.com') or popup an alert message or navigate to a simple plain url.The JavaScript function/URL that I need to call comes from the data. I have gone through the web but couldn't find any solution to this.Please let me kow if this is doable. If this is not possible with hyperlinkbutton please let me know if this is possible with any other control.
Regards,Sreedhar Buthalapalli
Hi Sreedhar,
So, i'm pretty sure that you can't call javascript methods from a Hyperlink button's NavigateUri, however, you can attach a Click event, and bind your data to the Tag of the button. Then you'll have all the data for a specific item, and can determine what functionality you'd like to invoke using SL.
<HyperlinkButton Content="Test" Tag="{Binding}" Click="HyperlinkButton_Click"></HyperlinkButton>
System.Windows.Browser.HtmlPage.Window.Alert("Test");
System.Windows.Browser.HtmlPage.PopupWindow(new Uri("http://www.google.com"), "_blank", new System.Windows.Browser.HtmlPopupWindowOptions());
Hope this helps,
-SteveZ