I am using JQuery's UI dialog to open a form. My attempt is to submit and close the dialog. I am having trouble.
The parent window opens the dialog (which contains a partial view) from click and form is submitted, for the first time, data is saved in DB. But if I click to open the dialog again and submit, there are 2 data rows saved in DB with the same value.
My code is below:
$('#newFileDialog').dialog('destroy');$('#newFileDialog').remove();
Is there something wrong with this code?
Your help is appreciated.
UPDATE:
Partial view:
@using(Html.BeginForm("New", "File", new {}, FormMethod.Post, new { Id = "newFileForm" } ))
{
@Html.ValidationSummary()
@Html.RenderHTML(
new TabContainerViewModel(
new TabViewModel { Name = "File", ViewName = "Common", Model = Model, Visible = true},
new TabViewModel { Name = "Permission", ViewName = string.Empty, Visible = true}
) { Id = "createFileTabs", Visible = true })
@Html.SubmitButton("Send")
}
@{ Html.JQueryAjaxForm("newFileForm", "containerComponentContent", string.Empty, "$('#newFileDialog').dialog('destroy');$('#newFileDialog').remove();showMessagebox('New File added');"); }