| View previous topic :: View next topic |
| Author |
Message |
Andreas Hansson Guest
|
Posted: Thu Oct 11, 2007 12:01 pm Post subject: Get actual object with ObjectforId |
|
|
I cannot get the actual object when passing Id between pages.
page1:
aSuggestion := StaffSuggestion.Create(EcoSpace);
UpdateDatabase;
DataBind;
Response.Redirect('suggestion_new.aspx?RootId=' +
IdForObject(aSuggestion.AsIObject));
This works just fine
suggestion_new.aspx:
This fails in Page_Load
CurrentStaffSuggestion := ObjectForId(Id) as StaffSuggestion;
I get "Specified cast is not valid"
How do I get the StaffSuggestion object again?
/Andreas |
|
| Back to top |
|
 |
Peter Morris Guest
|
Posted: Thu Oct 11, 2007 12:51 pm Post subject: Re: Get actual object with ObjectforId |
|
|
| Quote: | IdForObject(aSuggestion.AsIObject));
|
Here you passed an IObject
Here you got back an IObject
You need
CurrentStaffSuggestion := ObjectForId(Id).GetValue<StaffSuggestion>;
or
CurrentStaffSuggestion := ObjectForId(Id).AsObject as StaffSuggestion;
Pete |
|
| Back to top |
|
 |
|