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

How can I close radwindow without postback of page

1 Answer 17 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jenny
Top achievements
Rank 2
Jenny asked on 10 Dec 2018, 10:52 AM

Hello,

I have a page with rad tab there is in that there is radiobuttons. Radwindow is opening  from server side. On click of radiobutton radwindow should open without postback. I have used update panel for stoping postback so when i am clicking on radiobutton radwindow is opening without postback bt when i want to close , cancle , ok radwindow that time page is getting postback for that plz help me to stop postback.

Below I have attached code which i have tried:

javascript code

<script type="text/javascript">
function ExtraFixedFnctn1(arg) {
            if (arg) {
                $get("<%= hdfPrompt1.ClientID %>").value = arg;
                __doPostBack();
            }
            else if (!arg) {
                $get("<%= hdfPrompt1.ClientID %>").value = arg;
                    __doPostBack();
                }
        }
        function ExtraFixedFnctn2(arg) {
            if (arg) {
                $get("<%= hdfPrompt2.ClientID %>").value = arg;
                __doPostBack();
            }
            else if (!arg) {
                $get("<%= hdfPrompt2.ClientID %>").value = arg;
                        __doPostBack();
                    }
            }
            function ExtraFixedFnctn3(arg) {
                if (arg) {
                    $get("<%= hdfPrompt3.ClientID %>").value = arg;
                    __doPostBack();
                }
                else if (!arg) {
                    $get("<%= hdfPrompt3.ClientID %>").value = arg;
                        __doPostBack();
                    }
            }
            function ExtraFixedFnctn4(arg) {
                if (arg) {
                    $get("<%= hdfPrompt4.ClientID %>").value = arg;
                    __doPostBack();
                }
                else if (!arg) {
                    $get("<%= hdfPrompt4.ClientID %>").value = arg;
                    __doPostBack();
                }
        }
</script>

.aspx code

<telerik:RadWindowManager ID="RadWindowManager2" runat="server" Skin="Office2007">
    </telerik:RadWindowManager>
    <asp:HiddenField runat="server" ID="hdfPrompt1" Value="" />
    <asp:HiddenField runat="server" ID="hdfPrompt2" Value="" />
    <asp:HiddenField runat="server" ID="hdfPrompt3" Value="" />
    <asp:HiddenField runat="server" ID="hdfPrompt4" Value="" />
 <asp:UpdatePanel ID="Updatepanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
<telerik:RadPageView runat="server" ID="TaxInfo" TabIndex="2" Font-Names="Arial" ForeColor="DarkBlue">
                <br />
                 
                <table>
                    <tr>
                        <td style="text-align: center;" colspan="4">
                            <asp:Label runat="server" ID="lblTaxInfoError" SkinID="Error" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                </table>
 
                <div align="left" style="padding-left: 5px">
                    <table>
                        <tr>
                            <td style="text-align: center; font-weight: bold; font-size: medium; text-decoration: underline; font-family: Arial, Helvetica, sans-serif;" colspan="2">Federal</td>
                            <td style="text-align: center; font-weight: bold; font-size: medium; text-decoration: underline; font-family: Arial, Helvetica, sans-serif;" colspan="2">State</td>
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align: left; padding-left: 4px" class="auto-style23" colspan="2">
                                 
 
                            </td>
 
                            <td style="text-align: left">
                                <asp:Label ID="Label6" ForeColor="Red" runat="server" Text="*"></asp:Label>Withholding State: </td>
 
                            <td>
                                <div class="selectWrapper" style="border: 1px  solid red">
                                    <asp:DropDownList ID="ddlStateWithHoldingState" runat="server" CssClass="selectBox">
                                    </asp:DropDownList>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left">Marital Status: </td>
                            <td class="auto-style17">
                                <div class="selectWrapper">
                                    <asp:DropDownList ID="ddlFedMarital" runat="server" CssClass="selectBox">
                                    </asp:DropDownList>
                                </div>
                            </td>
                            <td style="text-align: left">Marital Status:
                            </td>
                            <td>
                                <div class="selectWrapper">
                                    <asp:DropDownList ID="ddlStateMarital" runat="server" CssClass="selectBox">
                                    </asp:DropDownList>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left" class="auto-style18">Exemptions:
                            </td>
                            <td class="auto-style19">
                                <asp:TextBox ID="txtFedExempt" runat="server" Width="30px" MaxLength="2" onfocus="this.select()" CssClass="input"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="reFederalExemptions" runat="server" ValidationGroup="EmployeeUpdate" ControlToValidate="txtFedExempt" ValidationExpression="^\d+$" ErrorMessage="Only numeric values are allowed." ForeColor="red" SetFocusOnError="true" Font-Size="Small"></asp:RegularExpressionValidator>
                            </td>
                            <td style="text-align: left" class="auto-style18">Exemptions:
                            </td>
                            <td class="auto-style18">
                                <asp:TextBox ID="txtStateExempt" onfocus="this.select()" runat="server" Width="30px" MaxLength="2" CssClass="input"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="reStateExemptions" runat="server" ControlToValidate="txtStateExempt" ValidationExpression="^\d+$" ValidationGroup="EmployeeUpdate"
                                    ErrorMessage="Only numeric values are allowed." ForeColor="red" SetFocusOnError="true"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <asp:RadioButton ID="rbFedExtra" runat="server" Text="Extra" OnCheckedChanged="rbFedExtra_CheckedChanged" GroupName="R1" AutoPostBack="true" />
                                <asp:RadioButton ID="rbFedFixed" runat="server" Text="Fixed" OnCheckedChanged="rbFedFixed_CheckedChanged" GroupName="R1" AutoPostBack="true" />
                            </td>
                            <td></td>
                            <td>
                                <asp:RadioButton ID="rbStateExtra" runat="server" Text="Extra" OnCheckedChanged="rbStateExtra_CheckedChanged" GroupName="R2" AutoPostBack="true" />
                                <asp:RadioButton ID="rbStateFixed" runat="server" Text="Fixed" OnCheckedChanged="rbStateFixed_CheckedChanged" GroupName="R2" AutoPostBack="true" />
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: left">Extra Withholding:
                            </td>
                            <td class="auto-style17">
                                <asp:RadioButton ID="rbFedExtraDollar" runat="server" Text="$" GroupName="Radio1" OnCheckedChanged="rbFedExtraDollar_CheckedChanged" AutoPostBack="true" Checked="true" />
                                <asp:RadioButton ID="rbFedExtraPercent" runat="server" Text="%" GroupName="Radio1" OnCheckedChanged="rbFedExtraPercent_CheckedChanged" AutoPostBack="true" />
                                <telerik:RadNumericTextBox ID="txtFEDExtraWH" runat="server" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn" MaxValue="999999.99" MinValue="000000.00" AllowOutOfRangeAutoCorrect="False"></telerik:RadNumericTextBox>
                                <br />
                                 
                                <asp:RegularExpressionValidator runat="server" ID="revFedExtraPercent" ControlToValidate="txtFEDExtraWH" Enabled="false"
                                    ErrorMessage="Enter value between 0 to 100" ForeColor="Red" ValidationGroup="EmployeeUpdate"
                                    ValidationExpression="^100(\.0{0,2}?)?$|^\d{0,2}(\.\d{0,2})?$" Display="Dynamic" SetFocusOnError="True">                    
                                </asp:RegularExpressionValidator>
                            </td>
                            <td style="text-align: left">Extra Withholding:
                            </td>
                            <td>
                                <asp:RadioButton ID="rbStateExtraDollar" runat="server" Text="$" GroupName="Radio2" OnCheckedChanged="rbStateExtraDollar_CheckedChanged" AutoPostBack="true" Checked="true" />
                                <asp:RadioButton ID="rbStateExtraPercent" runat="server" Text="%" GroupName="Radio2" AutoPostBack="true" OnCheckedChanged="rbStateExtraPercent_CheckedChanged" />
                                <telerik:RadNumericTextBox ID="txtStateExtraWH" runat="server" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn" AllowOutOfRangeAutoCorrect="False" MaxValue="999999.99" MinValue="000000.00"></telerik:RadNumericTextBox>
                                <br />
                                
                                <asp:RegularExpressionValidator runat="server" ID="revStateExtraPercent" ControlToValidate="txtStateExtraWH" Enabled="false"
                                    ErrorMessage="Enter value between 0 to 100" ForeColor="Red" ValidationGroup="EmployeeUpdate"
                                    ValidationExpression="^100(\.0{0,2}?)?$|^\d{0,2}(\.\d{0,2})?$" Display="Dynamic" SetFocusOnError="True">                    
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <br />
                        <tr>
                            <td style="text-align: left">Fixed Withholding:
                            </td>
                            <td class="auto-style17">
                                <asp:RadioButton ID="rbIsDollarFederal" runat="server" Text="$" GroupName="Radio" AutoPostBack="true" OnCheckedChanged="rbIsDollarFederal_CheckedChanged" Checked="true" />
                                <asp:RadioButton ID="rbIsPercentFederal" runat="server" Text="%" GroupName="Radio" AutoPostBack="true" OnCheckedChanged="rbIsPercentFederal_CheckedChanged" />
                                <telerik:RadNumericTextBox ID="txtFedFixedWH" runat="server" Enabled="true" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn" MaxValue="999999.99" MinValue="000000.00" AllowOutOfRangeAutoCorrect="False"></telerik:RadNumericTextBox>
                                <br />
                                <%--<asp:RegularExpressionValidator runat="server" ID="revdedamt" ValidationExpression="^[0-9]\d{0,9}(\.\d{1,2})?%?$" ValidationGroup="EmployeeUpdate"
                                    ErrorMessage="Enter only positive integer" ForeColor="Red" ControlToValidate="RadtxtFixedFederalWithholding" Display="Dynamic">
                                </asp:RegularExpressionValidator>
                                <br />--%>
                                <asp:RegularExpressionValidator runat="server" ID="rvFedWithholding" ControlToValidate="txtFedFixedWH" Enabled="false"
                                    ErrorMessage="Enter value between 0 to 100" ForeColor="Red" ValidationGroup="EmployeeUpdate"
                                    ValidationExpression="^100(\.0{0,2}?)?$|^\d{0,2}(\.\d{0,2})?$" Display="Dynamic" SetFocusOnError="True">                    
                                </asp:RegularExpressionValidator>
                                
                            </td>
                            <td style="text-align: left">Fixed Withholding:
                            </td>
                            <td>
                                <asp:RadioButton ID="rbIsDollarState" runat="server" Text="$" GroupName="Radio4" AutoPostBack="true" OnCheckedChanged="rbIsDollarState_CheckedChanged" Checked="true" />
                                <asp:RadioButton ID="rbIsPercentState" runat="server" Text="%" GroupName="Radio4" AutoPostBack="true" OnCheckedChanged="rbIsPercentState_CheckedChanged" />
                                <telerik:RadNumericTextBox ID="txtStateFixedWH" runat="server" Enabled="true" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn" MaxValue="999999.99" MinValue="000000.00" AllowOutOfRangeAutoCorrect="False"></telerik:RadNumericTextBox>
                                <br />
                                 
                                <asp:RegularExpressionValidator runat="server" ID="rvStateWithholding" ControlToValidate="txtStateFixedWH" Enabled="false"
                                    ErrorMessage="Enter value between 0 to 100" ForeColor="Red" ValidationGroup="EmployeeUpdate"
                                    ValidationExpression="^100(\.0{0,2}?)?$|^\d{0,2}(\.\d{0,2})?$" Display="Dynamic" SetFocusOnError="True">                    
                                </asp:RegularExpressionValidator>
                               </td>
                        </tr>
 
                        <tr>
 
                            <td></td>
                            <td></td>
                            <td>
                                <asp:Label ID="Label7" ForeColor="Red" runat="server" Text="*" />SUI State:
                            </td>
                            <td>
                                <div class="selectWrapper" style="border: 1px  solid red">
                                    <asp:DropDownList ID="ddlSUIState" runat="server" CssClass="selectBox">
                                    </asp:DropDownList>
                                </div>
                            </td>
                        </tr>
                        <tr>
 
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td style="text-align: left">Non-taxable pay only:
                            </td>
                            <td class="auto-style17">
                                <asp:CheckBox ID="chkNonTaxableApayAmount" runat="server" AutoPostBack="true" OnCheckedChanged="chkNonTaxableApayAmount_CheckedChanged"></asp:CheckBox>
                            </td>
                            <td style="text-align: left; visibility: hidden">Local Marital Status:
                            </td>
                            <td style="visibility: hidden">
                                <div class="selectWrapper">
                                    <asp:DropDownList ID="ddlLocalMaritalStatus" runat="server" CssClass="selectBox">
                                    </asp:DropDownList>
                                </div>
                            </td>
 
                        </tr>
                        <tr>
                            <td style="text-align: left">OASDI Exempt:
                            </td>
                            <td class="auto-style17">
                                <asp:CheckBox ID="chkOASDIExempt" runat="server"></asp:CheckBox>
                            </td>
                            <td style="text-align: left; visibility: hidden">Local Exemptions:
                            </td>
                            <td style="visibility: hidden">
                                <asp:TextBox ID="txtLocalExemptions" runat="server" Width="30px" MaxLength="2"></asp:TextBox>
                            </td>
 
                        </tr>
                        <tr>
                            <td style="text-align: left">Medicare Exempt:
                            </td>
                            <td class="auto-style17">
                                <asp:CheckBox ID="chkMedicareExempt" runat="server"></asp:CheckBox>
                            </td>
                            <td style="text-align: left; visibility: hidden">Extra Local Withholding:
                            </td>
                            <td style="visibility: hidden">
                                <telerik:RadNumericTextBox ID="RadtxtExtraLocalWithholding" runat="server" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn"></telerik:RadNumericTextBox>
 
                            </td>
 
                        </tr>
                        <tr>
 
                            <td style="text-align: left; visibility: hidden">Fixed Local Withholding:
                            </td>
                            <td style="visibility: hidden">
                                <asp:RadioButton ID="rbIsDollarLocal" runat="server" Text="$" GroupName="Radio3" Checked="true" />
                                <asp:RadioButton ID="rbIsPercentLocal" runat="server" Text="%" GroupName="Radio3" />
                                <telerik:RadNumericTextBox ID="RadtxtFixedLocalWithholding" runat="server" Enabled="true" Width="70px" NumberFormat-DecimalDigits="2" SelectionOnFocus="SelectAll" mask="nnnnnn.nn"></telerik:RadNumericTextBox>
 
                            </td>
 
                        </tr>
 
                    </table>
                </div>
                        
            </telerik:RadPageView>
 </ContentTemplate>
                    </asp:UpdatePanel>

.aspx.cs code

protected void rbFedExtra_CheckedChanged(object sender, EventArgs e)
        {
            EmployeePortal.Models.NCI.NCIEntities ent = EmployeePortal.Models.ClsNCIUtil.GetNCIEntity(Session["CustomerID"].ToString());
            using (ent)
            {
                var FedExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 4)).FirstOrDefault();//extra
                if (FedExtra == null)
                {
                    txtFEDExtraWH.Enabled = true;
                    rbFedExtraDollar.Enabled = true;
                    rbFedExtraPercent.Enabled = true;
                    txtFedFixedWH.Text = null;
                    txtFedFixedWH.Enabled = false;
                    rbIsDollarFederal.Enabled = false;
                    rbIsPercentFederal.Enabled = false;
                }
                else
                {
                    if (hdfPrompt1.Value == "")
                    {
                        RadWindowManager2.RadConfirm("Extra amounts override Fixed amounts. Fixed amount will be cleared.  Press OK to continue or Cancel to return to your changes.", "ExtraFixedFnctn1", 400, 150, null, "Extra/Fixed");
                    }
                    else if (hdfPrompt1.Value == "true")
                    {
                        txtFedFixedWH.Text = null;
                        txtFedFixedWH.Enabled = false;
                        rbIsDollarFederal.Enabled = false;
                        rbIsPercentFederal.Enabled = false;
                        txtFEDExtraWH.Enabled = true;
                        rbFedExtraDollar.Enabled = true;
                        rbFedExtraPercent.Enabled = true;
                        var PercentFedExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 1)).FirstOrDefault();//extra
                        if (PercentFedExtra != null && PercentFedExtra.TaxCalcId == 1)
                        {
                            rbIsDollarFederal.Checked = true;
                            rbIsPercentFederal.Checked = false;
                        }
                        if (PercentFedExtra != null && PercentFedExtra.TaxCalcId == 2)
                        {
                            rbIsPercentFederal.Checked = true;
                            rbIsDollarFederal.Checked = false;
                        }
                        var EmpFedFixed = (from a in ent.EmployeeTaxes
                                           where a.EmployeeId == empno && (a.TaxTypeId == 1)
                                           select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpFedFixed != null)
                        {
                            if (EmpFedFixed.Amount == null || EmpFedFixed.Amount == 0)
                                txtFEDExtraWH.Text = "0.00";
                            else
                                txtFEDExtraWH.Text = (EmpFedFixed.Amount).ToString();
                        }
                        var PercentFedFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 4)).FirstOrDefault();//fixed
                        if (PercentFedFixed != null && PercentFedFixed.TaxCalcId == 1)
                        {
                            rbFedExtraDollar.Checked = true;
                            rbFedExtraPercent.Checked = false;
                        }
                        if (PercentFedFixed != null && PercentFedFixed.TaxCalcId == 2)
                        {
                            rbFedExtraDollar.Checked = false;
                            rbFedExtraPercent.Checked = true;
                        }
                        var EmpFedExtra = (from a in ent.EmployeeTaxes
                                           where a.EmployeeId == empno && (a.TaxTypeId == 4)
                                           select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpFedExtra != null)
                        {
                            if (EmpFedExtra.Amount == null || EmpFedExtra.Amount == 0)
                                txtFEDExtraWH.Text = "0.00";
                            else
                                txtFEDExtraWH.Text = (EmpFedExtra.Amount).ToString();
                        }
                        hdfPrompt1.Value = "";
                    }
                    else if (hdfPrompt1.Value == "false")
                    {
                        rbFedExtra.Checked = false;
                        rbFedFixed.Checked = true;
                        hdfPrompt1.Value = "";
                    }
                }
            }
        }
        protected void rbFedFixed_CheckedChanged(object sender, EventArgs e)
        {
            EmployeePortal.Models.NCI.NCIEntities ent = EmployeePortal.Models.ClsNCIUtil.GetNCIEntity(Session["CustomerID"].ToString());
            using (ent)
            {
                var FedFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 1)).FirstOrDefault();//extra
                if (FedFixed == null)
                {
                    txtFedFixedWH.Enabled = true;
                    rbIsDollarFederal.Enabled = true;
                    rbIsPercentFederal.Enabled = true;
                    txtFEDExtraWH.Text = null;
                    txtFEDExtraWH.Enabled = false;
                    rbFedExtraDollar.Enabled = false;
                    rbFedExtraPercent.Enabled = false;
                }
                else
                {
                    if (hdfPrompt2.Value == "")
                    {
                        RadWindowManager2.RadConfirm("Fixed amounts override Extra amounts. Extra amount will be cleared.  Press OK to continue or Cancel to return to your changes.", "ExtraFixedFnctn2", 400, 150, null, "Extra/Fixed");
                    }
                    else if (hdfPrompt2.Value == "true")
                    {
                        txtFEDExtraWH.Text = null;
                        txtFEDExtraWH.Enabled = false;
                        rbFedExtraDollar.Enabled = false;
                        rbFedExtraPercent.Enabled = false;
                        txtFedFixedWH.Enabled = true;
                        rbIsDollarFederal.Enabled = true;
                        rbIsPercentFederal.Enabled = true;
                        var PercentFedExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 1)).FirstOrDefault();//extra
                        if (PercentFedExtra != null && PercentFedExtra.TaxCalcId == 1)
                        {
                            rbIsDollarFederal.Checked = true;
                            rbIsPercentFederal.Checked = false;
                        }
                        if (PercentFedExtra != null && PercentFedExtra.TaxCalcId == 2)
                        {
                            rbIsDollarFederal.Checked = false;
                            rbIsPercentFederal.Checked = true;
                        }
                        var EmpFedFixed = (from a in ent.EmployeeTaxes
                                           where a.EmployeeId == empno && (a.TaxTypeId == 1)
                                           select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpFedFixed != null)
                        {
                            if (EmpFedFixed.Amount == null || EmpFedFixed.Amount == 0)
                                txtFedFixedWH.Text = "0.00";
                            else
                                txtFedFixedWH.Text = (EmpFedFixed.Amount).ToString();
                        }
                        var PercentFedFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 4)).FirstOrDefault();//fixed
                        if (PercentFedFixed != null && PercentFedFixed.TaxCalcId == 1)
                        {
                            rbFedExtraDollar.Checked = true;
                            rbFedExtraPercent.Checked = false;
                        }
                        if (PercentFedFixed != null && PercentFedFixed.TaxCalcId == 2)
                        {
                            rbFedExtraDollar.Checked = false;
                            rbFedExtraPercent.Checked = true;
                        }
                        var EmpFedExtra = (from a in ent.EmployeeTaxes
                                           where a.EmployeeId == empno && (a.TaxTypeId == 4)
                                           select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpFedExtra != null)
                        {
 
                            if (EmpFedExtra.Amount == null || EmpFedExtra.Amount == 0)
                                txtFedFixedWH.Text = "0.00";
                            else
                                txtFedFixedWH.Text = (EmpFedExtra.Amount).ToString();
                        }
                        hdfPrompt2.Value = "";
                    }
                    else if (hdfPrompt2.Value == "false")
                    {
                        rbFedFixed.Checked = false;
                        rbFedExtra.Checked = true;
                        hdfPrompt2.Value = "";
                    }
                }
            }
        }
        protected void rbStateExtra_CheckedChanged(object sender, EventArgs e)
        {
            EmployeePortal.Models.NCI.NCIEntities ent = EmployeePortal.Models.ClsNCIUtil.GetNCIEntity(Session["CustomerID"].ToString());
            using (ent)
            {
                var StateExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 5)).FirstOrDefault();//extra
                if (StateExtra == null)
                {
                    txtStateExtraWH.Enabled = true;
                    rbStateExtraDollar.Enabled = true;
                    rbStateExtraPercent.Enabled = true;
                    txtStateFixedWH.Text = null;
                    txtStateFixedWH.Enabled = false;
                    rbIsDollarState.Enabled = false;
                    rbIsPercentState.Enabled = false;
                }
                else
                {
                    if (hdfPrompt3.Value == "")
                    {
                        RadWindowManager2.RadConfirm("Extra amounts will override Fixed amounts. Fixed amount will be cleared.  Press OK to continue or Cancel to return to your changes.", "ExtraFixedFnctn3", 400, 150, null, "Extra/Fixed");
                    }
                    else if (hdfPrompt3.Value == "true")
                    {
                        txtStateFixedWH.Text = null;
                        txtStateFixedWH.Enabled = false;
                        rbIsDollarState.Enabled = false;
                        rbIsPercentState.Enabled = false;
                        rbStateExtraDollar.Enabled = true;
                        rbStateExtraPercent.Enabled = true;
                        txtStateExtraWH.Enabled = true;
                        var PercentStateExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 2)).FirstOrDefault();//extra
                        if (PercentStateExtra != null && PercentStateExtra.TaxCalcId == 1)
                        {
                            rbIsDollarState.Checked = true;
                            rbIsPercentState.Checked = false;
                        }
                        if (PercentStateExtra != null && PercentStateExtra.TaxCalcId == 2)
                        {
                            rbIsDollarState.Checked = false;
                            rbIsPercentState.Checked = true;
                        }
                        var EmpStateFixed = (from a in ent.EmployeeTaxes
                                             where a.EmployeeId == empno && (a.TaxTypeId == 2)
                                             select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpStateFixed != null)
                        {
                            if (EmpStateFixed.Amount == null || EmpStateFixed.Amount == 0)
                                txtStateExtraWH.Text = "0.00";
                            else
                                txtStateExtraWH.Text = (EmpStateFixed.Amount).ToString();
                        }
                        var PercentStateFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 5)).FirstOrDefault();//fixed
                        if (PercentStateFixed != null && PercentStateFixed.TaxCalcId == 1)
                        {
                            rbStateExtraDollar.Checked = true;
                            rbStateExtraPercent.Checked = false;
                        }
                        if (PercentStateFixed != null && PercentStateFixed.TaxCalcId == 2)
                        {
                            rbStateExtraDollar.Checked = false;
                            rbStateExtraPercent.Checked = true;
                        }
                        var EmpStateExtra = (from a in ent.EmployeeTaxes
                                             where a.EmployeeId == empno && (a.TaxTypeId == 5)
                                             select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpStateExtra != null)
                        {
                            if (EmpStateExtra.Amount == null || EmpStateExtra.Amount == 0)
                                txtStateExtraWH.Text = "0.00";
                            else
                                txtStateExtraWH.Text = (EmpStateExtra.Amount).ToString();
                        }
                        hdfPrompt3.Value = "";
                    }
                    else if (hdfPrompt3.Value == "false")
                    {
                        rbStateExtra.Checked = false;
                        rbStateFixed.Checked = true;
                        hdfPrompt3.Value = "";
                    }
                }
            }
        }
        protected void rbStateFixed_CheckedChanged(object sender, EventArgs e)
        {
            EmployeePortal.Models.NCI.NCIEntities ent = EmployeePortal.Models.ClsNCIUtil.GetNCIEntity(Session["CustomerID"].ToString());
            using (ent)
            {
                var StateFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 2)).FirstOrDefault();//extra
                if (StateFixed == null)
                {
                    txtStateFixedWH.Enabled = true;
                    rbIsDollarState.Enabled = true;
                    rbIsPercentState.Enabled = true;
                    txtStateExtraWH.Text = null;
                    txtStateExtraWH.Enabled = false;
                    rbStateExtraDollar.Enabled = false;
                    rbStateExtraPercent.Enabled = false;
                }
                else
                {
                    if (hdfPrompt4.Value == "")
                    {
                        RadWindowManager2.RadConfirm("Fixed amounts will override Extra amounts. Extra amount will be cleared.  Press OK to continue or Cancel to return to your changes.", "ExtraFixedFnctn4", 400, 150, null, "Extra/Fixed");
                    }
                    else if (hdfPrompt4.Value == "true")
                    {
                        txtStateExtraWH.Text = null;
                        txtStateExtraWH.Enabled = false;
                        rbStateExtraDollar.Enabled = false;
                        rbStateExtraPercent.Enabled = false;
                        rbIsDollarState.Enabled = true;
                        rbIsPercentState.Enabled = true;
                        txtStateFixedWH.Enabled = true;
                        var PercentStateExtra = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 2)).FirstOrDefault();//extra
                        if (PercentStateExtra != null && PercentStateExtra.TaxCalcId == 1)
                        {
                            rbIsDollarState.Checked = true;
                            rbIsPercentState.Checked = false;
                        }
                        if (PercentStateExtra != null && PercentStateExtra.TaxCalcId == 2)
                        {
                            rbIsDollarState.Checked = false;
                            rbIsPercentState.Checked = true;
                        }
                        var EmpStateFixed = (from a in ent.EmployeeTaxes
                                             where a.EmployeeId == empno && (a.TaxTypeId == 2)
                                             select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpStateFixed != null)
                        {
                            if (EmpStateFixed.Amount == null || EmpStateFixed.Amount == 0)
                                txtStateFixedWH.Text = "0.00";
                            else
                                txtStateFixedWH.Text = (EmpStateFixed.Amount).ToString();
                        }
                        var PercentStateFixed = (ent.EmployeeTaxes.Where(a => a.EmployeeId == empno && a.TaxTypeId == 5)).FirstOrDefault();//fixed
                        if (PercentStateFixed != null && PercentStateFixed.TaxCalcId == 1)
                        {
                            rbStateExtraDollar.Checked = true;
                            rbStateExtraPercent.Checked = false;
                        }
                        if (PercentStateFixed != null && PercentStateFixed.TaxCalcId == 2)
                        {
                            rbStateExtraDollar.Checked = false;
                            rbStateExtraPercent.Checked = true;
                        }
                        var EmpStateExtra = (from a in ent.EmployeeTaxes
                                             where a.EmployeeId == empno && (a.TaxTypeId == 5)
                                             select new { a.EmployeeId, a.MaritalStatus, a.NumExemptions, a.Amount, a.TaxCalcId }).FirstOrDefault();
                        if (EmpStateExtra != null)
                        {
                            if (EmpStateExtra.Amount == null || EmpStateExtra.Amount == 0)
                                txtStateFixedWH.Text = "0.00";
                            else
                                txtStateFixedWH.Text = (EmpStateExtra.Amount).ToString();
                        }
                        hdfPrompt4.Value = "";
                    }
                    else if (hdfPrompt4.Value == "false")
                    {
                        rbStateFixed.Checked = false;
                        rbStateExtra.Checked = true;
                        hdfPrompt4.Value = "";
                    }
                }
            }
        }

 

Please help me as soon as possible.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 Dec 2018, 07:58 PM
Hi Jenny,

An update panel does not stop the postback, it merely makes it use an asynchronous request so that the server only returns some HTML and not the entire page.

Also, judging from the markup below - you seem to be using a multipage control and the way to ajax-enable it is to wrap the entire control in the update panel, no a single page view (alternatively, you can wrap the contents in the update panel but then the multipage will not participate in the response).

That said, the issue stems from the use of the __doPostBack() method without arguments - it will do a full postback on the form and you seem to require a partial postback. I suggest you review the second and third examples on the following page that show a couple of ideas that avoid full postbacks, so you can get started: https://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/using-radconfirm-in-server-code.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
Jenny
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Share this question
or