I have a form being built where I want to test for a field value and then
ensure the form's view is set correctly based on that value.
pseudo-code:
OnLoad()
{
check for status_field value
If (status_field value == "new") XDocument.View.SwitchView("Request");
... more tests etc.
Problem:
When this occurs in the OnLoad function the view object is returning null
and then I can't test views, set views, etc.
Attempting to manually create a view object reference fails, with the same
result (obj doesn't exist or is null) but just on differentlines of code.
Any thoughts on how I can get the view to set correctly based on the field
value?
S.Y.M. Wong-A-Ton - 02 Nov 2006 06:53 GMT
Try
XDocument.ViewInfos["Request"].IsDefault = true;
instead of
XDocument.View.SwitchView("Request");
---
S.Y.M. Wong-A-Ton
> I have a form being built where I want to test for a field value and then
> ensure the form's view is set correctly based on that value.
[quoted text clipped - 15 lines]
> Any thoughts on how I can get the view to set correctly based on the field
> value?
bshea - 02 Nov 2006 18:58 GMT
This seems to work, thanks! (still testing all my use cases but the initial
case tested success.
> Try
>
[quoted text clipped - 26 lines]
> > Any thoughts on how I can get the view to set correctly based on the field
> > value?