views:

20

answers:

1

when I am trying to write javascript in xaml page itself it is showing some error.

<script type="javascript">
....
</script>

can we write javascript function for form validation in silverlight .xaml file ?

+1  A: 

You cannot place a Script tag inside Xaml. However if you are simply rendering Xaml in the silverlight plugin you can wire up events that run javascript from a script block included in the HTML page that host the plugin. See this example.

AnthonyWJones
I am not hosting silverlight from aspx page or Html page while I am designing pure silverlight application.In such case what can I do for validation although validation summry is there in silverlight controls but I dont want to use that.Is there any way to use java script for validation?
nectar
Unless the app is an OOB (Out of Browser) app, it's going to be ultimately hosted in an html page. If you really wanted to do validation in JS, you can use JS interop to communicate with your Silverlight Application: http://msdn.microsoft.com/en-us/library/cc903928%28VS.95%29.aspx
Page Brooks