views:

272

answers:

2

using the Silverlight control (asp:Silverlight) on an aspx page, is there a way to customize the behavior if silverlight does not exist? I want to display a table with images in them if silverlight does not exist on the client.

+1  A: 

The asp:Silverlight server control just renders some client side script to create the host/sink for Silverlight, you can test this yourself, but you have to do this with JavaScript. It's possible that the asp:Silverlight control supports this but I reckon you'll have to write something yourself. In that case, look up how a Silverlight host is created in the browser, that's where you'll find your answer.

You're dilemma is that the asp:Silverlight server control runs before any client side code. You'll probably have to write some custom JavaScript to hande this and it won't be possible to let the server take action unless you have a reliable User-Agent string, which is unlikely.

John Leidegren
+2  A: 

Tim Heuer has written lots of info about this. Here's the main point, straight from his blog:

    <asp:Silverlight ID="Xaml1" runat="server"
     Source="~/ClientBin_SilverlightApplication1.xap" 
                 MinimumVersion="2.0.30523" Width="100%" Height="100%">
             <PluginNotInstalledTemplate>


             Your Content goes here.


             </PluginNotInstalledTemplate>
        </asp:Silverlight>

Here is the original blog post
http://timheuer.com/blog/archive/2008/03/25/creating-a-great-silverlight-deployment-experience.aspx

And a couple follow ups
http://timheuer.com/blog/archive/2008/09/08/silverlight-install-experience-too-hard.aspx http://timheuer.com/blog/archive/2008/12/02/silverlight-install-experience-best-practices-netflix.aspx

And, for your viewing pleasure
http://silverlight.net/learn/learnvideo.aspx?video=57016

TJB