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

Postback doesn't work after validation is javascript

1 Answer 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pavel Brokhman
Top achievements
Rank 1
Pavel Brokhman asked on 26 Jul 2010, 09:10 PM

I have RadTabStrip on my page. The problem I try to solve is not allow to pass to other tab if validation is failed.
For that I have next controls:
1. Validation controls connected to the specific control such as:
It is just example. As you see this control validation control is part of the some group

<asp:TextBox ID="txtEmployeeNo" CssClass="readOnlyTextbox" runat="server" Enabled="false"  />
<asp:ImageButton ID="imbChangeEmployeeNo" runat="server" ImageUrl="./../Images/Search.gif"
    CommandName="ChangeEmployee" ToolTip="Change Employee" />
<asp:RequiredFieldValidator ID="reqlblEmployeeNoEdit" runat="server" ErrorMessage="Employee No is required."
    Display="None" ControlToValidate="txtEmployeeNo" ValidationGroup="valGrpGeneral" Enabled="false"></asp:RequiredFieldValidator>
2. Validation summary control
<asp:ValidationSummary ID="valSumGeneral" runat="server" DisplayMode="BulletList"
    HeaderText="The following inputs are invalid:" ValidationGroup="valGrpGeneral"
    ShowMessageBox="true" ShowSummary="false" />
3. Tab Client Event
function OnClientTabSelecting(sender, eventArgs) {
    var newTab = eventArgs.get_tab();
    if (newTab != null) {
        var oldTab = newTab.get_parent().get_selectedTab();
        if (oldTab != null) {
            switch (oldTab.get_value()) {
                case "<%= GeneralTabValue %>":
                    eventArgs.set_cancel(!Page_ClientValidate("<%=GeneralTabSummaryValidationName %>"));
                    break;
            
        }
    }

Validation is working OK, but.... There is some other logic related to postbacks stopped to work, immediately after I am using OnClientTabSelecting. For instant, I have button which execute ModalWindow using JavaScript. This modal window is returning some values:
function ShowModalWindow(ctrl1ID, ctrl2ID, ctrl3ID, url) {
    var ret = window.showModalDialog(url, this, 'dialogWidth=975px;dialogHeight=670px;resizable=yes;help=no;');
    var ctrl1 = document.getElementById(ctrl1ID); // 'R' = HR Reason Code, 'E' = Employee ID, 'P' = Position
    var ctrl2 = document.getElementById(ctrl2ID); // The returned value
    var ctrl3 = document.getElementById(ctrl3ID); // Whether or not to open the control in edit mode.
    if (ret != null && ctrl1 != null && ctrl2 != null && ctrl3 != null) {
        if (ret.length > 1) {
            ctrl1.value = ret[0];
            ctrl2.value = ret[1];
            ctrl3.value = ret[2];
        }
    }
}
Once windows is closed in usual situation postback occurs and page is refreshed according to data returned from the windows.

BUT, after OnClientTabSelecting, although javascript is executed, postback doesn't.

Does anyone know what it might be the reason?

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 29 Jul 2010, 04:55 PM
Hello Pavel,

I'm not able to understand your scenario, could you please send us more complete code which we can easily test and explain in more details the problem? Thanks

Best regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Pavel Brokhman
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or