TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
praveen mariappan
NA
17
4.9k
WP7 - Date not getting updated after editing from datepicker
Jun 6 2013 12:41 AM
Hi,
I am currently using the Datepicker provided from the windows phone 7 toolkit nov 2011.
once i select the date in the date picker it gets updated in the textbox. As soon as i leave the page and return back to it and try to change the date from the date picker it open the date pikcer selection page and also able to choose the date. But after choosing the date and selecting it , the already selected date is not getting updated.(i.e., first i select the date 06/06/2013 and closing the page. Again im reopening the page and changing the date to 07/06/2013. But the old date 06/05/2013 is not getting updated).
It remains the same even after changing the date from the date picker.
So far i googled i found out that "whenever i select date in datepicker it moves to new page, after selecting new date and press back button it".
Please help/provide me a suggestion to solve my current problem.
Thanks in Advance.
FYI i have given the code of my application....
Xaml code :
<toolkit:DatePicker Margin="139,237,0,451" x:Name="txt_DateOfPurchase" FontSize="18" Grid.ColumnSpan="2" Grid.Column="1" Width="254" ValueStringFormat="{}{0:d}" Value="" />
C# code :
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.New)
{
parameterValue = NavigationContext.QueryString["parameter"];
Action = NavigationContext.QueryString["action"];
using (AppliancedataContext Appliance = new AppliancedataContext(strConnectionString))
{
var a = from b in Appliance.GetTable<ApplianceInfo>() where b.ApplianceName == parameterValue.ToString() select b;
foreach (var x in a)
{
txt_ApplianceName.Text = x.ApplianceName;
txt_DateOfPurchase.ValueStringFormat = x.DateOfPurchase;
if (Action == "EditData")
{
btnAdd.Content = "Edit";
}
if (Action == "Edit")
{
btnAdd.Content = "Edit Data";
}
}
}
}
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
using (AppliancedataContext ApplianceDB = new AppliancedataContext(strConnectionString))
{
if (Action == "Edit" || Action == "EditData")
{
var Appliance = (from i in ApplianceDB.GetTable<ApplianceInfo>()
where i.ApplianceName == parameterValue.ToString()
select i).Single();
Appliance.ApplianceName = txt_ApplianceName.Text.ToString();
Appliance.DateOfPurchase = txt_DateOfPurchase.ValueString.ToString();
ApplianceDB.SubmitChanges();
MessageBox.Show("Updated");
}
else
{
ApplianceInfo NewAppliance = new ApplianceInfo
{
ApplianceName = txt_ApplianceName.Text.ToString(),
DateOfPurchase = txt_DateOfPurchase.ValueString.ToString(),
};
if (txt_ApplianceName.Text != "")
{
ApplianceDB.Appliances.InsertOnSubmit(NewAppliance);
ApplianceDB.SubmitChanges();
MessageBox.Show("added");
}
}
}
}
Reply
Answers (
0
)
Drag n resize dynamic object
how to change next Gif image in windows phone 7?