May 06, 2014, 2:14 PM
Ext.Net and MVC - Close Window based on condition
I am using Ext.Net in an MVC application. On my main page, I have a Window that launches a partial view based on a condition -
I have stepped through and verify that the correct bool value is being passed and it goes into the else part of the statement, but the window is still rendered (or is still remaining in the DOM from the previous rendering).
Here is my controller action for the partial -
I have tried using javascript / jquery to close the window, but have not had any luck.
If more code is needed, let me know and I can post accordingly.
Thanks
@if(Model.ShowScreen)
{
@(x.Window()
.ID("myWindow")
.Title("My Title")
.Icon(Icon.Application)
.Height(550)
.Width(500)
.Modal(true)
.Content(c => @Html.Partial("MyPartial", Model))
)
}
else
{
// Not sure what goes here
}
I expect that if the showscreen bool in the model is true, then the Window will show. If the bool is false, the window should not appear. I am able to render the view once and the window shows up as expected. However, if I change the bool to false and attempt to re-render the page, the window is still appearing.I have stepped through and verify that the correct bool value is being passed and it goes into the else part of the statement, but the window is still rendered (or is still remaining in the DOM from the previous rendering).
Here is my controller action for the partial -
[HttpPost]
public ActionResult MyPartial(MyViewModel model)
{
return RedirectToAction("Index", new { @id = model.myId });
}
Does anyone know what I would have to do in order to get the Window to not render / be closed?I have tried using javascript / jquery to close the window, but have not had any luck.
If more code is needed, let me know and I can post accordingly.
Thanks