Click here to Skip to main content
15,887,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Been atempting to pass values in xaml page to another.Help with the code below

Page 1
C#
private void btnEmailLogin_Click(object sender, RoutedEventArgs e)
       {
            string emailAddress = txtEmailAddress.Text;
           string txtPasswords = txtPassword.Text;
           NavigationService.Navigate(new Uri(string.Format("/EmailSender.xaml?emailAddress={0}&txtPasswords={1}", emailAddress, txtPasswords), UriKind.Relative));


       }

Page 2

C#
if (this.NavigationContext.QueryString.ContainsKey("emailAddress") || this.NavigationContext.QueryString.ContainsKey("password"))
            {
               this.txtFrom.Text = this.NavigationContext.QueryString["emailAddress"];
                       }


I get a nullRefrenceException in the if statement...Need help
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900