This is a migrated thread and some comments may be shown as answers.

[Solved] Radwindow closing after <asp:RequiredFieldValidator> popup

1 Answer 230 Views
Window
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 10 Apr 2008, 07:35 AM

We have an "ADD" asp:LinkButton to add values inside a radwindow. We Use
OnClientClick="GetRadWindow().BrowserWindow.location.reload();GetRadWindow().Close()" to add the value and refresh the parent page.

using <asp:RequiredFieldValidator> if an error pops up after hitting the add linkbutton the window closes. Anyway to prevent the window for closing upon validation error? Looking to keep user inside radwindow to fix error before closing the window.

<code used to close radwindow>


function GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;//Will work in Moz in all cases, including clasic dialog
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)
    return oWindow;

function CloseOnReload()
{
    GetRadWindow().Close();
}

function RefreshParentPage()
{
    GetRadWindow().BrowserWindow.location.reload();
}


1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 15 Apr 2008, 02:31 PM
Hello Marc,

Generally speaking when you have validation errors, postback is not performed and server code does not execute. When the validation has passed successfully, the page is postbacked and the server code is executed.

Therefore I suggest to execute the script which closes the RadWindow in the server-side eventhandler of the link button. In this manner, when the validation fails, it will not be executed and the RadWindow will not be closed. If the validation is successful the closing script will be executed and the window will close.

I prepared a sample project which demonstrates the desired functionality - you can find it in the attached archive file.


Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Marc
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or