0

I need to display the longlistselector data in a new page when an item was selected.. im getting an error message System.Argument.Exception so plz help me to solve this issue..

my selectedindex change code..

private void OrganizationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{                
   NavigationService.Navigate(new Uri("Organization_Details.xaml?selectedItem" +Organization.Name , UriKind.Relative));
}

Error:

enter image description here In the navigated page, i'm jus using a text block to display my data..and the code is..

Organization org;//Class name with obj

public Organization_Details()
{
    InitializeComponent();

    org_name.Text = org.name;//textblock(org_name)-->needs to set the data from the b4 page..
}

enter image description here

Error in navigated page...

Community
  • 1
  • 1
faroke moahmed
  • 313
  • 1
  • 5
  • 19
  • Follow this Page, might get your answer: http://stackoverflow.com/questions/10016387/passing-data-object-between-xaml-pages – wafers Nov 14 '13 at 12:09

2 Answers2

2

try this

 NavigationService.Navigate(new Uri("/Organization_Details.xaml?selectedItem=" +Organization.Name , UriKind.Relative));

You have missed "/" at the begining of your url and "=" after selectedItem

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
  • 1
    And he misses "=" after selectedItem. – venerik Nov 14 '13 at 12:17
  • Thanx guys..when i navigate to next page im getting another error.. plz help me...check the post again.. – faroke moahmed Nov 14 '13 at 12:32
  • 1
    Maybe you should first look at a tutorial like http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/Navigating-and-Passing-Data-between-XAML-Pages – venerik Nov 14 '13 at 12:34
  • Seriously, read something about it! Stack overflow is not a trial and error forum. One more resource: http://www.codeproject.com/Tips/620719/Windows-Phone-Page-Navigation – venerik Nov 14 '13 at 18:33
0

You can not get the value directly, so use the following function,

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
            if (e.Uri.OriginalString.Contains("selectedItem"))
            {
                //Get the value here
            }
     }

This would work fine for you!!

Aju
  • 796
  • 3
  • 10
  • 29