i have two user controls name as ucProject, ucProjectActivity respectively inside my single .xaml page
i need to do simple operation like, once ucProject submit their value into to the database after this operation it would get the ID of newly inserted record of project and pass this newly inserted project id to the ucProjectActivity user control for their submission.
so it's kind of two operation
1) ucProject submission ------> after submission it would pass Id of newly inserted record of project id to ucProjectActivity user control.
2) get the project id from first user control name as UcProject and next operation will be ucProjectActivity submission.
my code;
private void btnSubmit_Click(object sender, RoutedEventArgs e)
{
ucProject.Submitprojectdetails();
ucProjectActivity.SubmitProjectActivity(ucProject.ProjectId);
}
inside the ucproject
public void Submitprojectdetails()
{
oProjectDetail.BintModifiedBy = app.CurrentUser.BintUserID;
oProjectDetail.DtModifiedDate = DateTime.Now;
oProjectDetailContext.InsertUpdateTblProject(oProjectDetail, InsertUpdateTblProject_Complete, null);
}
public void InsertUpdateTblProject_Complete(InvokeOperation
{
ProjectId = operation.Value;
}
but after complete Submitprojectdetails() operation it directly go to ucProjectActivity.SubmitProjectActivity() rather than complete operation.
so i am getting ucProject.ProjectId = 0 value always actually it's wrong.
So look for the solution,
i have projectprofile.xaml page inside this there is two user control ucproject and ucProjectActivity
at first in .xaml page when we click on submit button,
private void btnSubmit_Click(object sender, RoutedEventArgs e)
{
/*use entitly class of project details of UcProject usercontrol for submission rathar than submitting inside code behind of ucProject user control.see the code;*/
ProjectDetail oProjectDetail = UcProject.oProjectDetail;
oProjectDetailContext.InsertUpdateTblProject(oProjectDetail, InsertUpdateTblProject_Complete, null);
}
public void InsertUpdateTblProject_Complete(InvokeOperation
{
ucProjectActivity.SubmitProjectActivity(operation.Value);
}
now it's work.