aspx与silverlight的传参问题

ContactShow.aspx:

View Code
 1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ContactShow.aspx.cs" Inherits="Strongsoft.FloodControl.Web.Contact.ContactShow" %>

 2 <%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls" TagPrefix="asp" %>

 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 4 

 5 <html xmlns="http://www.w3.org/1999/xhtml">

 6 <head runat="server">

 7     <title>联系人详细信息</title>

 8 </head>

 9 <body>

10     <form id="form1" runat="server">

11         <asp:Silverlight id="modContact" runat="server" 

12         Source="~/ClientBin/Strongsoft.Sub.Contact.xap" Width="100%" Height="700px" 

13         MinimumVersion="3.0" />

14     </form>

15 </body>

16 </html>

ContactShow.aspx.cs:

View Code
 1 using System;

 2 using System.Collections.Generic;

 3 using System.Linq;

 4 using System.Web;

 5 using System.Web.UI;

 6 using System.Web.UI.WebControls;

 7 

 8 namespace Strongsoft.FloodControl.Web.Contact

 9 {

10     public partial class ContactShow : System.Web.UI.Page

11     {

12         protected void Page_Load(object sender, EventArgs e)

13         {

14             string type = Request["type"] == null ? string.Empty : Request["type"].ToString();

15             string id = Request["id"] == null ? string.Empty : Request["id"].ToString();

16             modContact.InitParameters = "type=" + type + ",id=" + id + ",init=Show";

17         }

18     }

19 }

App.xaml.cs:

View Code
 1  private void Application_Startup(object sender, StartupEventArgs e)

 2         {

 3             if (e.InitParams["init"] == "Show") //调用通用显示控件

 4             {

 5                 this.RootVisual = new ContactShow(e.InitParams["id"], e.initParams["type"]);

 6             }

 7             else //正常启动通讯录

 8             {

 9                  ...

10             }

11         }

你可能感兴趣的:(silverlight)