user1397396
user1397396

Reputation: 31

Windows Phone 7:Transfer some data from first page to seond page

A have a two pages:

FirstPage — some data; SecondPage — three TextBlocks (they need to pass some data);

but transmitted in only one, how to transfer to other?

FirstPage one parametr transfer:

NavigationService.Navigate(new Uri("/Total.xaml?Pay=" + Uri.EscapeDataString(logic3.ToString()), UriKind.Relative));

SecondPage:

if (NavigationContext.QueryString.ContainsKey("Pay")) 
            {
                paymentTextBlock.Text = NavigationContext.QueryString["Pay"].ToString();
            }

How to pass other data?

Thanks!

Upvotes: 1

Views: 271

Answers (1)

Robaticus
Robaticus

Reputation: 23157

Just add the others to the end of your Uri using ampersands &.

NavigationService
  .Navigate(new Uri("/Total.xaml?Pay=" + Uri.EscapeDataString(logic3.ToString()) + 
                    "&Parm2=" + Uri.EscapeDataString(someOtherField.ToString(), 
                     UriKind.Relative));

Upvotes: 2

Related Questions