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

Grid Insert/Edit fails validation, cancel tab change

4 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
THOMAS
Top achievements
Rank 1
THOMAS asked on 21 Apr 2011, 04:24 PM
We have a RadTabStrip controlling a RadMultiPage.  In three of the RadPageViews we have a RadGrid.  The EditForm of these RadGrids contains ASP RequiredFieldValidators.  The problem occurs when the RequiredFieldValidators are not satisfied, the user changes tabs, and tries to navigate away from the page which calls Page.Validate().  The validation errors do not stop RadTab change and are no longer visible.  I'm looking for a way to stop that RadTab navigation from occurring when there are ASP.NET Validation errors.  (2010.3.1109.35)  Thank you.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Apr 2011, 07:20 AM
Hello Thomas,

You can easily achieve this by setthing RadTabstrip  CausesValidation property to "true".

Thanks,
Shinu.
0
THOMAS
Top achievements
Rank 1
answered on 25 Apr 2011, 03:17 PM
CausesValidation is already set to true.
0
Marin
Telerik team
answered on 27 Apr 2011, 08:06 AM
Hello Thomas,

Another option might be to handle the RadTabStrip OnClientTabSelecting event and check there whether the page has validation errors and cancel the event if needed.

Greetings,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
THOMAS
Top achievements
Rank 1
answered on 28 Apr 2011, 03:25 PM
I added the handler below for the OnClientTabSelecting event which did the trick.

function MatterTabSelecting(sender, eventArgs) {
    if (typeof (Page_ClientValidate) == 'function') {
        Page_ClientValidate();
        if (!Page_IsValid)
            eventArgs.set_cancel(true);
    }
 
    return false;
}
Tags
Grid
Asked by
THOMAS
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
THOMAS
Top achievements
Rank 1
Marin
Telerik team
Share this question
or