Hi,
Cannot make this happen, assignment to _parent crashes.

Do I have to make a reference to it inside it and use it like: _parent.SelfReference = null ?
Hi,
Cannot make this happen, assignment to _parent crashes.

Do I have to make a reference to it inside it and use it like: _parent.SelfReference = null ?
UPDATE
It works if I go like this:
![]()
Is this sane?
PS: In what context are those assignments run on the server? I ask because it is not in the form of {command: SomeHandlerInTheVM()}.
UPDATE
I’ve settled for the bellow form because other things need to happen in the parent VM, so needing to trigger custom event towards parent, inside Close()
![]()
I’m very surprised that the assignment to _parent works in the command binding. I though we don’t support this, because it was hard to make run on the server, in JS it should be easy.
I have always done it using the _parent.SelfReference = null, in your case I suppose it would be _parent2.ModalViewModel = null
The entire body of the command binding is run on the server. Even if you use {command: 0}, we run the entire postback pipeline. Only staticCommand is this hybrid where it runs client-side, but you can invoke server-side method.
yeah, but in what context run on the server?
PS
If I have
{command: SomeHandlerInTheVM()} . I know that is the context, the VM method.
I’m not sure I understand the question. The binding is “simply” compiled as a function which we execute after the Load phase. Data context is taken from the control where it is declared
I don’t know how to say it… I’m just curious what are the whereabouts, the medium in which resides that code. I don’t know how it is made to work… like with some special closure / constructed handler … I don’t know.
LE: I understand now (it is compiled and then executed in the DotVVM pipeline at that point in the lifecycle)
Well, we can go depths on this
, if you have specific question I’m happy to answer, but I’m not sure I give a reasonable general answer.
Yes it’s compiled by DotVVM, we compile it through Linq.Expressions.Expression, so it isn’t exactly a C# function, but should be close enough. The data context variables are obviously special - the data context is in the DataContext properties. We essentially collect the required data contexts from the control tree, before executing your expression (I still think that the _parent=null assignment cannot work). The compilation happens during the first page load, otherwise you would get syntax error only after you click the button, which is undesirable.
I hurry with things here and please excuse me, I was wrong saying it works (all of them).
What I was sure that works is just these two (no exception thrown though, like in the case of staticCommand):
![]()
No in depth now, no-no ![]()
Ok that’s quite possible that we don’t throw the exception, but the _parent=null statement is noop. That would be good to fix in the next major