RadTabStrip with AJAX Manager causes JS error

8 posts, 0 answers
  1. Billy
    Billy avatar
    8 posts
    Member since:
    May 2009

    Posted 22 Jun 2009 Link to this post

    HI,

    I am using a Telerik AJAX Manager to have a button control update a MultiPage control.  

    My Multipage contains several pageviews that each contain a reportviewer control.  On the first load, everything works great.  However when I do a postback, I get my updated pageviews and everything appears correct, but there are JS errors everytime I move the mouse over the pageview or click on the reportviewer control.  I also get the errors when changing tabs.  They are preventing me from being able to use reportviewer features such as printing and paging.  

    Most errors are:  "Microsoft JScript runtime error: Object expected"

    When I remove do a full postback by setting the postback URL of the button, everything works and I get no JScript errors.  I think this has to do with the viewstate, but I'm not sure.

    Any help is much appreciated.

    Thanks!
    Billy
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 23 Jun 2009 Link to this post

    Hello Billy,

    I think it will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

    Thanks beforehand for your patience and cooperation,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Billy
    Billy avatar
    8 posts
    Member since:
    May 2009

    Posted 23 Jun 2009 Link to this post

    Hi Paul,

    Unfortunately, I won't be able to send a working project because the reports are server reports hosted by SSRS.  Here are code samples from the markup...

    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"/> 
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="cbM0010"
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="cbM0016" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="btnUpdate"
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RMPReports" LoadingPanelID="RALP" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 

      <telerik:RadAjaxLoadingPanel ID="RALP" runat="server" BackgroundPosition="Center"
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
                style="border: 0px;" /></telerik:RadAjaxLoadingPanel> 
                <telerik:RadTabStrip ID="RTSReports" runat="server" ShowBaseLine="True" 
                Width="100%" MultiPageID="RMPReports" Skin="Outlook" SelectedIndex="0"
        </telerik:RadTabStrip>     
        <telerik:RadMultiPage ID="RMPReports" runat="server" SelectedIndex="0"
        </telerik:RadMultiPage> 

    And the code...

     
            Private Sub Page_Init(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Init 
     
                If Not IsPostBack Then 
                    LoadTabStrip() 
                Else 
                    ReLoadTabStrip() 
                End If 
                 
            End Sub 
     
     
     Private Sub LoadTabStrip() 
     
                Dim cnn As SqlConnection 
                Dim cmd As SqlCommand 
                Dim dr As SqlDataReader 
                Dim SQL As String 
     
                Dim TempTab As Telerik.Web.UI.RadTab 
                Dim TempPageView As Telerik.Web.UI.RadPageView 
                Dim TempReport As ReportViewer 
     
                Dim sReportShortName As String 
                Dim sReportLongName As String 
     
                'Dim bFirstTab As Boolean = True 
     
                SQL = "SELECT " & vbCrLf & _ 
                      "     rt.ReportName " & vbCrLf & _ 
                      " FROM ReportsInUsers ru (NOLOCK) " & vbCrLf & _ 
                      "     INNER JOIN REF_ReportTypes rt (NOLOCK) ON ru.K_ReportTypeID = rt.K_ReportTypeID " & vbCrLf & _ 
                      "     AND rt.ReportTab = 'QA Interactive' " & vbCrLf & _ 
                      "     AND ru.UserName = '" & _sUserName & "' " & vbCrLf & _ 
                      "     AND rt.Status = 'A' AND ru.FlagStatus = 'A' " 
     
                Try 
                    'open the connection 
                    cnn = New SqlConnection(_sConnectionString) 
                    cnn.Open() 
     
                    'create a datareader 
                    cmd = New SqlCommand(SQL, cnn) 
                    dr = cmd.ExecuteReader() 
     
                    While (dr.Read) 
     
                        'create new tab 
                        TempTab = New Telerik.Web.UI.RadTab() 
     
                        ''if its the first one then select it 
                        'If bFirstTab Then 
                        '    TempTab.Selected = True 
                        '    bFirstTab = False 
                        'End If 
     
                        sReportShortName = CStr(dr.Item(0)).Replace("Quality Assurance""QA").Replace(" On Demand"""
                        sReportLongName = CStr(dr.Item(0)).Replace(" """
     
                        'Add tabs to tabstrip based on the users reports 
                        TempTab.Text = sReportShortName 
                        RTSReports.Tabs.Add(TempTab) 
     
                        'create reportviewer control and save for later 
                        TempReport = New ReportViewer() 
                        TempReport.ID = "rvIReport_" & sReportLongName 
                        _dctReports.Add(dr.Item(0), TempReport) 
     
                        'add a reportviewer to a radpageview control 
                        TempPageView = New Telerik.Web.UI.RadPageView() 
                        TempPageView.ID = "RPV_" & sReportLongName 
                        TempPageView.Controls.Add(TempReport) 
     
                        'add the radpageview to the radmultipage control associated with the tabstrip 
                        RMPReports.Controls.Add(TempPageView) 
     
                    End While 
     
                Catch ex As Exception 
                    'write to errors to the trace file 
                    _Tracer.WriteTrace("An error occured while attempting to create a datareader with the following SQL: " & vbCrLf & _ 
                                       "[" & SQL & "].", ex) 
     
                    'write error to event log and redirect to error page 
                    Log_Error(Me, ex.ToString(), "IReportTemplate.LoadTabStrip"
                Finally 
                    'close the connection if necessary 
                    If cnn IsNot Nothing AndAlso cnn.State <> ConnectionState.Closed Then 
                        cnn.Close() 
                    End If 
                End Try 
     
            End Sub 
     
            Private Sub ReLoadTabStrip() 
     
                Dim TempControl As Control 
                Dim TempPageView As Telerik.Web.UI.RadPageView 
                Dim TempReport As ReportViewer 
     
                Dim SQL As String 
                Dim cnn As SqlConnection 
                Dim cmd As SqlCommand 
                Dim dr As SqlDataReader 
     
                Dim sReportShortName As String 
                Dim sReportLongName As String 
     
                SQL = "SELECT " & vbCrLf & _ 
                      "     rt.ReportName " & vbCrLf & _ 
                      " FROM ReportsInUsers ru (NOLOCK) " & vbCrLf & _ 
                      "     INNER JOIN REF_ReportTypes rt (NOLOCK) ON ru.K_ReportTypeID = rt.K_ReportTypeID " & vbCrLf & _ 
                      "     AND rt.ReportTab = 'QA Interactive' " & vbCrLf & _ 
                      "     AND ru.UserName = '" & _sUserName & "' " & vbCrLf & _ 
                      "     AND rt.Status = 'A' AND ru.FlagStatus = 'A' " 
     
                Try 
                    'open the connection 
                    cnn = New SqlConnection(_sConnectionString) 
                    cnn.Open() 
     
                    'create a datareader 
                    cmd = New SqlCommand(SQL, cnn) 
                    dr = cmd.ExecuteReader() 
     
                    'find the existing radpageviews and add the new reportviewers 
                    While (dr.Read) 
     
                        'get the report name 
                        sReportShortName = CStr(dr.Item(0)).Replace("Quality Assurance""QA").Replace(" On Demand"""
                        sReportLongName = CStr(dr.Item(0)).Replace(" """
     
                        'remove the old pageview 
                        TempControl = RMPReports.FindControl("RPV_" & sReportLongName) 
                        RMPReports.Controls.Remove(TempControl) 
                        TempControl = Nothing 
     
                        'create reportviewer control and save for later 
                        TempReport = New ReportViewer() 
                        TempReport.ID = "rvIReport_" & sReportLongName 
                        _dctReports.Add(dr.Item(0), TempReport) 
     
                        'create a new one 
                        TempPageView = New Telerik.Web.UI.RadPageView() 
                        TempPageView.ID = "RPV_" & sReportLongName 
                        TempPageView.Controls.Add(TempReport) 
                        RMPReports.Controls.Add(TempPageView) 
     
                    End While 
     
                Catch ex As Exception 
                    'write to errors to the trace file 
                    _Tracer.WriteTrace("An error occured while attempting to create a datareader with the following SQL: " & vbCrLf & _ 
                                       "[" & SQL & "].", ex) 
     
                    'write error to event log and redirect to error page 
                    Log_Error(Me, ex.ToString(), "IReportTemplate.ReloadTabStrip"
                Finally 
                    'close the connection if necessary 
                    If cnn IsNot Nothing AndAlso cnn.State <> ConnectionState.Closed Then 
                        cnn.Close() 
                    End If 
                End Try 
     
     
            End Sub 


    Any suggestions would be appreciated.

    Billy

  5. Sanjay
    Sanjay avatar
    2 posts
    Member since:
    May 2009

    Posted 25 Jun 2009 Link to this post

    Thanks Billy for posting the above problem. I am also getting the similar kind of error when I am trying to load ReportViewer Control to RadPageView. It throws me a JS error as below:

    "Problems with this webpage might prevent it from being displayed properly or functioning properly. In future, you can display this message by double-clicking the warning icon displayed in the status bar.

    Line: 414
    Char: 1
    Error: Object expected
    Code: 0

    "
    I tried to load different other control to the RadpageView & it works fine but does not work when loading ReportViewer Control. I am not sure if RadPageView support ReportView control...

    If any one already tried to use the above controls and got any success please let me know.

    Thanks,
    Sanjay.
  6. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 26 Jun 2009 Link to this post

    Hi there,

    Could you please check if your code works out of RadMultipage control and if everything is fine after ajax update? 

    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  7. Sanjay
    Sanjay avatar
    2 posts
    Member since:
    May 2009

    Posted 26 Jun 2009 Link to this post

    Hi Paul,

    I am using the RadTabStrip and RadMultiPage inside a ajax:TabPanel, which is inside ajax updatepannel. Do you think, is that some thing to do with the error. I was going through some outside forums which indicate some incompatibility between Reportviewer Control & ajax update pannel. Can you please let me know more about this?

    Thanks,
    Sanjay. 
  8. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 30 Jun 2009 Link to this post

    Hi Sanjay,

    I'm afraid the issue is not related to any Telerik control, therefore we cannot help further on the matter.

    Kind regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  9. Krishna
    Krishna avatar
    2 posts
    Member since:
    Feb 2012

    Posted 03 Apr 2012 Link to this post

    Hi Paul,
     I'm facing the issue with telerik controls. I want to load RadAjaxLoadingPanel for click event of tabs in RadTabStrip.
    I'm unable achieve this,every time it showing an error. I tried many ways to resolve the issue. But no use. Can you please do favor me
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017