如何使用WCF在页面之间导航和传递值 [英] How to Navigate and Pass Values between Pages using WCF

查看:95
本文介绍了如何使用WCF在页面之间导航和传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用listbox_selectionchange将数据从1页的列表框传递到另一页的4文本框.

但我是新来的,

到目前为止,我已经找到了类似的编码,并如下进行编辑,

I want to pass the data from a listbox at 1page to the 4 text box that at another page using listbox_selectionchange.

But i am new to this,

so far i had found alike coding and edit it as below,

private void ListBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            {
                string EmpId = (ListBox1.SelectedItem as ViewDataListBox.ServiceReference1.MyEmployee).EmpId ;
                NavigationService.Navigate(
                    new Uri(String.Format("/EditPage.xaml?EmpId={0}", EmpId), UriKind.Relative));
            }
        }





what should i put for at my editPage to call out the value?

推荐答案

您如何托管服务?如果您的服务托管在IIS中,则有可能在两次调用之间回收了该应用程序.在这种情况下,将重新创建应用程序域,并且静态成员会释放其值.

如果itz位于同一应用程序和不同页面中,则简单的解决方案是在各个页面之间共享的全局实例.
How are you hosting your service? If your service is hosted in IIS, it is possible that the application was recycled between the 2 calls. In this case the app domain is recreated and the static members loose their values.

If itz within the same app and different pages, then the simple solution is global instance to share across the pages.


这篇关于如何使用WCF在页面之间导航和传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆