RadTabStrip working in properly , displays previous report popups

2 Answers 17 Views
PdfViewer TabStrip Window
Guru Karun
Top achievements
Rank 1
Guru Karun asked on 05 May 2025, 12:49 PM | edited on 05 May 2025, 01:03 PM

HI Team,  RadTabStrip malfunctioning and is showing popups from previous reports

after viewing the report, when navigating to the history tab, the report view reappears, which is inconsistent with the existing functionality. The report view in the history tab shouldn't appear.

here i implemneted the code like

C# code behind aspx.cs

 UbAjaxMngr.ResponseScripts.Add("Report('" + IMPORTID + "');");

front end aspx page updated

// Placeholder function to register Report via Sys Application load
    function Report(args) {
        Sys.Application.add_load(function () {
            ReportUpdated(args);
  //Clear args at the end
   args = "";
        });
    }
            function ReportUpdated(args) {
                alert("The data has been imported. Please continue to view the Import Report");
                var IMPORTID = args;
var manager = $find("<%= rwmReqMgr.ClientID %>");
if (manager) {
var owin = manager.getWindowByName("ReqMgrPopUp");
console.log("RadWindow Manager Working Tecnics: ");
if (owin) {
owin.setUrl("../../Reports/Pages/Script/frmScript_report.aspx?IMPORTID=" + IMPORTID);
owin.set_title("Blumen Message Wizard");
owin.setSize(1080, 600);
owin.set_visibleStatusbar(false);
owin.show();
owin.center();
} else {
console.error("Could not find the RadWindow.");
                  }
  } 
else  {
console.log("RadWindowManager is not initialized.");
      }
// Clear args at the end
   args = null;
        } 

Working good for all browsers (IE,Chromo,Mozilla) But,

ref screenshots:

Up to here working good, Script Import Mapping functions correctly in both Internet Explorer and Google Chrome.However, an Issue occurs: after viewing the report, when navigating to the history tab, the report view reappears, which is inconsistent with the existing functionality. The report view in the history tab does not disappear until the X button is clicked to close the current main field details.

here is the screen shots

Above screen should not display report popup again.

It should  display screen like below

Provideing History Tab code

// For History Tab

<telerik:RadPageView ID="rpvHistory" runat="server">
                <table width="99%">
                    <tr>
                        <td align="right">
                            <asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="../../Image/remove.png"
                                AlternateText="Delete Report" SkinID="Remove" Height="25px" Width="25px" OnClick="Deletereport" />Delete
                            Report
                            <asp:ImageButton runat="server" ImageUrl="../../Image/View-report.png" AlternateText="View Report"
                                Height="25px" Width="25px" OnClick="showreport" />Print Report
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <telerik:RadGrid ID="grdHistory" runat="server" AutoGenerateColumns="false" Skin="Office2007"
                                ItemStyle-Wrap="true" Height="330px">
                                <MasterTableView ClientDataKeyNames="IMPORTID" Width="100%" HeaderStyle-Height="25px"
                                    ItemStyle-Height="25px">
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="REPORT NAME" DataField="REPORTNAME">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Table Name's" DataField="TABLENAMES">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Import-Date & Time" DataField="IMPORT_DATETIME">
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <ClientEvents OnRowClick="histrowClick" OnRowDblClick="grdhistdblClick" />
                                    <Scrolling AllowScroll="true" SaveScrollPosition="true" ScrollHeight="150" UseStaticHeaders="true" />
                                    <Selecting AllowRowSelect="true" />
                                </ClientSettings>
                            </telerik:RadGrid>
                            <asp:LinkButton runat="server" ID="lnkHistory" OnClick="showreport"></asp:LinkButton>
                        </td>
                    </tr>
                </table>
            </telerik:RadPageView>

// telerik tab strips
<telerik:RadTabStrip ID="Imp_tabstrip" runat="server" MultiPageID="imp_pgview" OnClientTabSelected="ClientTabSelected">
            <Tabs>
                <telerik:RadTab runat="server" Text="MAIN" PageViewID="RpvMain" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="YEARLY" PageViewID="rpvYEARLY" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="SEMESTER" PageViewID="rpvsemister" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="COURSES" PageViewID="rpvCOURSES" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="CONTACT" PageViewID="rpvCONTACT" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="MAINCFIELDS" PageViewID="rpvMAINCFIELDS" Visible="false">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="History" PageViewID="rpvHistory">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="NoAccess" PageViewID="rpvNoAccess" Visible="false">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>

//Here tab selected change js code
function ClientTabSelected(sender, args) {
                var tab = args.get_tab();
                if (tab.get_text() == "History") {
                    $find("<%= UbAjaxMngr.ClientID %>").ajaxRequest("loadTabs");
                }
            }

// telerik control details

<telerik:RadAjaxManager ID="UbAjaxMngr" runat="server" OnAjaxRequest="UbAjaxMngr_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="UbAjaxMngr">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="AjaxloadingDiv" />
                    <telerik:AjaxUpdatedControl ControlID="Ajaxloadingimg" />
                    <telerik:AjaxUpdatedControl ControlID="litErrorMsg" />
                    <telerik:AjaxUpdatedControl ControlID="rlExcellFields" />
                    <telerik:AjaxUpdatedControl ControlID="RadGridYearly" />
                    <telerik:AjaxUpdatedControl ControlID="RadgrdSemister" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrdCourses" />
                    <telerik:AjaxUpdatedControl ControlID="asncMainFilUpload" />
                    <telerik:AjaxUpdatedControl ControlID="RadAsyYearlyUpload" />
                    <telerik:AjaxUpdatedControl ControlID="asncSEMfilupload" />
                    <telerik:AjaxUpdatedControl ControlID="asncCORSfilupload" />
                    <telerik:AjaxUpdatedControl ControlID="hdnMainFields" />                    
                    <telerik:AjaxUpdatedControl ControlID="hdnYearlyFields" />
                    <telerik:AjaxUpdatedControl ControlID="hdnSemisterfields" />
                    <telerik:AjaxUpdatedControl ControlID="hdncoursefields" />
                    <telerik:AjaxUpdatedControl ControlID="Imp_tabstrip" />
                    <telerik:AjaxUpdatedControl ControlID="hdnTableNames" />
                    <telerik:AjaxUpdatedControl ControlID="grdHistory" />
                    <telerik:AjaxUpdatedControl ControlID="hdnhistImpid" />
                    <telerik:AjaxUpdatedControl ControlID="hdnMainUnique" />
                    <telerik:AjaxUpdatedControl ControlID="hdnYearlyUnique" />
                    <telerik:AjaxUpdatedControl ControlID="hdnCoursesUnique" />
                    <telerik:AjaxUpdatedControl ControlID="hdnSemesterUnique" />
                    <telerik:AjaxUpdatedControl ControlID="hdnSuccessids" />                    
                    <telerik:AjaxUpdatedControl ControlID="hdnMinimumStuids" />
                    <telerik:AjaxUpdatedControl ControlID="hdnSelectFCfields" />                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

So where i need to update in tab history selected cahnge event to avoid again to diaply report popup.

Please guide us.

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 May 2025, 01:33 PM

Hi Guru ,

To resolve the issue of the report popup reappearing when navigating to the history tab, you need to ensure that the popup is triggered only when necessary. Here's a step-by-step guide to help you address the problem:

1. Manage Popup State
Ensure that the popup is only opened when it is required. You can use a flag to track whether the popup should be displayed.

2. Update Client-Side Code
Modify the ClientTabSelected function to prevent the popup from being shown when the "History" tab is selected. You can add a condition to check if the popup is already open and avoid reopening it.

 

function ClientTabSelected(sender, args) {
    var tab = args.get_tab();
    if (tab.get_text() === "History") {
        // Check if the report popup is already shown
        var manager = $find("<%= rwmReqMgr.ClientID %>");
        if (manager) {
            var owin = manager.getWindowByName("ReqMgrPopUp");
            if (owin && owin.isVisible()) {
                // If the popup is visible, do not trigger it again
                console.log("Popup is already visible, not opening again.");
                return;
            }
        }
        // Proceed with AJAX request if needed
        $find("<%= UbAjaxMngr.ClientID %>").ajaxRequest("loadTabs");
    }
}

 

3. Server-Side Logic
Ensure that your server-side logic does not re-trigger the popup when navigating to the history tab. Handle the AjaxRequest event and decide whether to trigger the popup based on the request argument.

 

protected void UbAjaxMngr_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    if (e.Argument == "loadTabs")
    {
        // Logic to determine if the popup should be re-opened
        // For example, check if it's already open or if it should be opened
        // UbAjaxMngr.ResponseScripts.Add("Report('" + IMPORTID + "');");
    }
}

 

4. Debugging
Use browser console logs to verify that the popup is not being triggered unintentionally.
Ensure that the Report function is not being called from any other unintended part of the code.
By implementing these changes, you should be able to control the behavior of the report popup and prevent it from appearing again when switching to the history tab. If the issue persists, isolate it in a simple runnable project and send it for examination via a support ticket.

    Regards,
    Rumen
    Progress Telerik

    Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
    Guru Karun
    Top achievements
    Rank 1
    commented on 06 May 2025, 02:17 PM | edited

    Thanks for Replay @Rumen , 

    For server side code as you mentioned, 

    protected void UbAjaxMngr_AjaxRequest(object sender, AjaxRequestEventArgs e) { if (e.Argument == "loadTabs") { // Logic to determine if the popup should be re-opened// For example, check if it's already open or if it should be opened// UbAjaxMngr.ResponseScripts.Add("Report('" + IMPORTID + "');"); } }

    // Here is our code

    protected void UbAjaxMngr_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
           
            try
            {
                if (e.Argument == "bindMain")
                    BindExcellFields("MAIN");           
                else if (e.Argument == "bindCource")
                    BindExcellFields("COURSES");
    else if (e.Argument == "loadTabs")
                {
                    if (Imp_tabstrip.SelectedTab.PageViewID == "rpvHistory")
                        BindHistory();
                }
            }
            catch (Exception ex)
            {
                litErrorMsg.Text = ex.Message;
                ErrorHandler objErrorHandler = new ErrorHandler();
                objErrorHandler.LogError(ex);
            }
        } //Here Imp_tabstrip is RadTabStrip ID , rpvHistory is History tab ID and where as BindHistory method should required to load radgrid data in tabhistory content

    Please suggest US...

     

    Guru Karun
    Top achievements
    Rank 1
    commented on 06 May 2025, 04:23 PM

    one of the reason using function Sys.Application.add_load ?

    // Placeholder function to register Report via Sys Application load
        function Report(args) {
            Sys.Application.add_load(function () {
                ReportUpdated(args);
      //Clear args at the end
       args = "";
            });
        }


    0
    Rumen
    Telerik team
    answered on 06 May 2025, 06:44 PM

    Hi Guru,

    The Sys.Application.add_load method is a key feature of ASP.NET AJAX applications. It ensures that certain JavaScript code is executed only after the page has fully loaded. This is particularly useful when dealing with AJAX controls, as it guarantees that the necessary client-side objects are created and available before executing any operations on them. Here's why you might use this method:

    • Ensuring Correct Timing: The add_load method ensures that your JavaScript code runs at the appropriate time, after all client-side components have been initialized. This prevents errors related to accessing uninitialized or undefined objects.

    • Initialization of AJAX Controls: In the context of Telerik's AJAX controls, such as RadWindowManager, these controls are created during the Sys.Application.init event. Using Sys.Application.add_load makes sure that any operations involving these controls are performed after they are fully initialized.

    • Avoiding Common Errors: By deferring the execution of scripts until the load event, you avoid common errors like "object expected" or "undefined object," which occur when trying to manipulate DOM elements or AJAX controls before they are ready.

    Addressing the Server-Side Code Issue

    For your server-side code, it seems you're handling AJAX requests based on different arguments. In the UbAjaxMngr_AjaxRequest method, you're checking the argument passed and performing actions accordingly. To avoid reopening the report popup when navigating to the history tab, you should ensure that the logic in BindHistory() does not inadvertently trigger the popup. Here's what you can consider:

    • Conditionally Trigger Popup: Make sure that your server-side logic only triggers the popup when necessary. You might want to add a condition to check whether the popup should be displayed based on your application's state or user actions.

    • Clear Arguments: After handling the necessary operations, clear or reset any arguments or flags that might cause the popup to be triggered again unintentionally.

    Example Code Snippet

    You can modify your code to ensure the popup is only triggered when needed, by checking its visibility:

    function ClientTabSelected(sender, args) {
        var tab = args.get_tab();
        if (tab.get_text() === "History") {
            var manager = $find("<%= rwmReqMgr.ClientID %>");
            if (manager) {
                var owin = manager.getWindowByName("ReqMgrPopUp");
                if (owin && owin.isVisible()) {
                    console.log("Popup is already visible, not opening again.");
                    return;
                }
            }
            $find("<%= UbAjaxMngr.ClientID %>").ajaxRequest("loadTabs");
        }
    }
    

    On the server side, ensure you do not trigger the popup unnecessarily:

    protected void UbAjaxMngr_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "loadTabs")
        {
            if (Imp_tabstrip.SelectedTab.PageViewID == "rpvHistory")
            {
                BindHistory();
                // Ensure popup logic is not triggered here
            }
        }
    }
    

    By implementing these changes, you should be able to control the behavior of the report popup and prevent it from appearing again when switching to the history tab. If the issue persists, further debugging might be required to isolate the problem.

      Regards,
      Rumen
      Progress Telerik

      Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
      Tags
      PdfViewer TabStrip Window
      Asked by
      Guru Karun
      Top achievements
      Rank 1
      Answers by
      Rumen
      Telerik team
      Share this question
      or