如何将ASP.NET查询字符串值传递给我的silverlight 2控件?

时间:2021-08-08 15:25:41

I have an ASP.NET page. What I want to do is pass in an ID field that is in the querystring.

我有一个ASP.NET页面。我想要做的是传入查询字符串中的ID字段。

So if my page is

所以如果我的页面是

http://www.mysite.com/default.aspx?id=35

I want a silverlight control that is on this page to have access to the id field. My silverlight control is going to get data for a grid and it needs to use the id.

我希望此页面上的silverlight控件可以访问id字段。我的silverlight控件将获取网格数据,它需要使用id。

2 个解决方案

#1


While this covers the concept in startup parameters (which is possibly what you are doing) here's a walk-through about it. http://silverlight.net/learn/learnvideo.aspx?video=72312

虽然这涵盖了启动参数中的概念(这可能就是你正在做的),但这里有一个关于它的演练。 http://silverlight.net/learn/learnvideo.aspx?video=72312

#2


You can use the HTML DOM Bridge to do that:

您可以使用HTML DOM Bridge执行此操作:

using System.Windows.Browser;

string queryString = HtmlPage.Document.DocumentUri.Query;

#1


While this covers the concept in startup parameters (which is possibly what you are doing) here's a walk-through about it. http://silverlight.net/learn/learnvideo.aspx?video=72312

虽然这涵盖了启动参数中的概念(这可能就是你正在做的),但这里有一个关于它的演练。 http://silverlight.net/learn/learnvideo.aspx?video=72312

#2


You can use the HTML DOM Bridge to do that:

您可以使用HTML DOM Bridge执行此操作:

using System.Windows.Browser;

string queryString = HtmlPage.Document.DocumentUri.Query;