惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
T
Threat Research - Cisco Blogs
Cloudbric
Cloudbric
Recent Commits to openclaw:main
Recent Commits to openclaw:main
I
Intezer
Attack and Defense Labs
Attack and Defense Labs
P
Privacy International News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
C
Cybersecurity and Infrastructure Security Agency CISA
V2EX - 技术
V2EX - 技术
AWS News Blog
AWS News Blog
O
OpenAI News
L
LINUX DO - 最新话题
N
News | PayPal Newsroom
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
A
Arctic Wolf
Spread Privacy
Spread Privacy
G
GRAHAM CLULEY
T
Tor Project blog
博客园_首页
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
S
Secure Thoughts
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
T
Tailwind CSS Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Visual Studio Blog
J
Java Code Geeks
Cisco Talos Blog
Cisco Talos Blog
Schneier on Security
Schneier on Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security Affairs
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
宝玉的分享
宝玉的分享
量子位
Last Week in AI
Last Week in AI
月光博客
月光博客
罗磊的独立博客
S
SegmentFault 最新的问题

博客园 - WEBBER

SQL语句中使用变量作为条件。遇到NULL时怎么写 checkbox单选 T4MVC Documentation page(转) ASIHTTPRequest 详解, http 请求终结者 (转) ASP.NET版Memcached监控工具(转) 完整的DataTable和list转换 老外写的(转) 技巧:使用User Control做HTML生成(转) Silverlight跟ASP.NET之間要如何溝通querystring(转) IIS6 Silverlight部署經驗(转) c#四种eval方法(转) - WEBBER - 博客园 一行内文本超出指定宽度溢出的处理 sql2005数据同步技术(数据订阅,发布)转 C# 域用户操作(转) 看到了一些面试题,发给大家,看看多少人能都全回答上来 Membership角色与权限管理 (转) 我的跳槽求职经验谈(转) IHttpHandler的妙用(2):防盗链!我的资源只有我的用户才能下载 (转) JavaScript组件之JQuery(A~Z)教程(基于Asp.net运行环境)(转) 说说大型高并发高负载网站的系统架构 (转)
asp.net取得Silverlight中的值(转)
WEBBER · 2009-09-29 · via 博客园 - WEBBER

转自:http://social.msdn.microsoft.com/Forums/zh-TW/1511/thread/2142d892-be3a-4726-9df4-df68dae1d76d
您可以參考下列做法:
1. 在SL中:

Imports System.Windows.Browser

<ScriptableType()> _

Partial Public Class Page

    Inherits UserControl

    Public Sub New()

        InitializeComponent()

        HtmlPage.RegisterScriptableObject("Test", Me)

    End Sub

    ' This is Scriptable function

    <ScriptableMember()> _

    Public Function XXX() As String

        Return txt1.Text

    End Function

End Class

在ASPX中:

<script language="javascript" type="text/javascript"  >

        function GetParamFromSL() {

            var silverlight = document.getElementById("SL");

            if (silverlight) {

                var rValue = silverlight.Content.Test.XXX();

                alert(rValue);

            }

        }

    </script>

</head>

<body>

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

    <div>

        <asp:ScriptManager ID="ScriptManager1" runat="server"

            EnableScriptGlobalization="True" EnablePageMethods="True">

        </asp:ScriptManager>

        <div style="height: 100%;">

            <asp:Silverlight ID="SL" runat="server" Source="~/ClientBin/SilverlightApplication1.xap"

                MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />

            <asp:Button ID="Button1" runat="server" OnClientClick="JavaScript:GetParamFromSL(); return false;"

                Text="Button" />

        </div>

    </div>

    </form>

</body>

測試過 OK, 您參考看看..