简体   繁体   中英

cannnot able to perform update on navigation in wp7

i want to Create a Simple Database in wp7.In Mainpage i simply add the Records in database and i have another button view which is used to navigate to another page where gridview control is there that can display the data from database that is already done.In the second page i have two Buttons delete and update and i have a textbox where user can enter the id and based on that id the delete and update process can be done.i done the delete operation but i don't know how to update the selected id because onclicking the update button it should navigate to main page and their corresponding values have to be filled in respective fields.when i tried to use onnavigated method to get the selected id record and if the page loads during startup it throws exception "no key was found" in the line

var n = PhoneApplicationService.Current.State ["list"];

how to make the application to load so that it does not consider the key.please help me to solve this problem.Thanks

Just check to see if the key exists first:

if (PhoneApplicationService.Current.State.ContainsKey("list") == true)
{
    n = PhoneApplicationService.Current.State["list"];
    PhoneApplicationService.Current.State.Remove("list");
}

before trying to load it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM