After some research, it is my understanding that this is not possible. I can use query strings to pass information, but that requires reloading the page. I can use web services too, but I'd rather avoid that if possible. At this point, I don't care about being able to do it or not, but I'd like to know WHY I can't do it. It seems like I should be able to call it's public functions like any other object.
经过一些研究,我的理解是这是不可能的。我可以使用查询字符串来传递信息,但这需要重新加载页面。我也可以使用Web服务,但如果可能的话,我宁愿避免使用它。在这一点上,我不关心能否做到,但我想知道为什么我不能这样做。看起来我应该可以像任何其他对象一样调用它的公共函数。
2 个解决方案
#1
5
It's not possible, because the silverlight's code behind is not server code, it's client code.
这是不可能的,因为后面的silverlight代码不是服务器代码,而是客户端代码。
The server code and client code doesn't exist in the same place, and they don't exist at the same time.
服务器代码和客户端代码不存在于同一位置,并且它们不存在于同一时间。
#2
0
You might want to explain more of what you're trying to accomplish than how you're trying to accomplish it. For instance, you can maintain a duplex connection between client and server, allowing you to "push" information down from your ASP.NET application to your Silverlight object. There are a lot of other lightweight alternatives that don't require a full-featured webservice.
您可能想要解释更多关于您要完成的内容而不是尝试完成它的内容。例如,您可以在客户端和服务器之间维护双工连接,从而允许您将信息从ASP.NET应用程序“推送”到Silverlight对象。还有许多其他轻量级替代品不需要功能齐全的Web服务。
Why do you like to be able to call Silverlight methods from your ASP.NET code?
为什么您希望能够从ASP.NET代码中调用Silverlight方法?
#1
5
It's not possible, because the silverlight's code behind is not server code, it's client code.
这是不可能的,因为后面的silverlight代码不是服务器代码,而是客户端代码。
The server code and client code doesn't exist in the same place, and they don't exist at the same time.
服务器代码和客户端代码不存在于同一位置,并且它们不存在于同一时间。
#2
0
You might want to explain more of what you're trying to accomplish than how you're trying to accomplish it. For instance, you can maintain a duplex connection between client and server, allowing you to "push" information down from your ASP.NET application to your Silverlight object. There are a lot of other lightweight alternatives that don't require a full-featured webservice.
您可能想要解释更多关于您要完成的内容而不是尝试完成它的内容。例如,您可以在客户端和服务器之间维护双工连接,从而允许您将信息从ASP.NET应用程序“推送”到Silverlight对象。还有许多其他轻量级替代品不需要功能齐全的Web服务。
Why do you like to be able to call Silverlight methods from your ASP.NET code?
为什么您希望能够从ASP.NET代码中调用Silverlight方法?