INCLUDE_DATA

Posts Tagged ‘visual studio’

JavaScript Reporting Services ReportViewer control error fix

December 8th, 2008

I have been going back and forth banging my head against a wall trying to fix a JavaScript error that was happening on my Reporting Services ReportViewer control when the View Report button is clicked.  The error was a JavaScript error and seemed to be related to using something AJAX related on the same page as the ReportViewer control, but it took me a while to figure out what it was and fix it.  All of the problems I saw on the web related to using either an AJAX update panel or one of the extenders in the AJAX Control Toolkit.  Unfortunately for me I wasn’t using either one of them so trying to figure this one out was tricky.

The specific JavaScript error was:

Microsoft JScript runtime error: ‘this._postBackSettings.async’ is null or not an object

My page was setup where I had a master page with an AJAX menu on it (Radmenu to be specific).  In order to use the Radmenu you need a ScriptManager object.  Other than the menu, I didn’t have any AJAX related controls on either the master page or the content page.

What I eventually figured out was that my report pages (which use a base class) needed to disable partial rendering.  To do this, you must do it in your page’s init event.  If you do it after the init you’ll get an invalid operation exception.  Here’s the code in the base class (you can put this in your code behind if you’re not using a base class):

    Private Sub Page_Init1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
 
        ' Make sure this page has a master page
        If Not IsNothing(Me.Master) Then
 
            Dim masterScriptManager As ScriptManager
            masterScriptManager = CType(Master.FindControl("MasterScriptManager"), ScriptManager)
 
            ' Make sure our master page has the script manager we're looking for
            If Not IsNothing(masterScriptManager) Then
 
                ' Turn off partial page postbacks for this page
                masterScriptManager.EnablePartialRendering = False
            End If
 
        End If
 
    End Sub

Just in case others stumble across this and are trying to solve their problem, here are some of the links I landed on when trying to solve the problem:

Testing email when working with no SMTP server

January 9th, 2008

Happy New Year!

While this tip isn’t my own, it still seems as though it will be very helpful.  I know that I do a lot of development locally where I don’t have an SMTP server setup.  This tip, courtsey of .NET Tip of the Day, really will eliminate that problem and allow you to work with email without the headaches.

Testing code that sends email has always been a pain. You had to set up a SMTP service just to test that your .NET application sends the e-mail correctly.

However, there is a way to send e-mails with no SMTP server set up. Just configure your .NET application to drop e-mails into a specified folder instead of sending them via SMTP server:

<system.net>

<mailSettings>

<smtp deliveryMethod=”SpecifiedPickupDirectory”>

<specifiedPickupDirectory pickupDirectoryLocation=”c:\Test\” />

</smtp>

</mailSettings>

</system.net>

This will instruct SmtpClient class to generate mail message, save it as .eml file and drop it into c:\Test\ folder.

How to enable IntelliSense in .skin files in Visual Studio 2005

August 28th, 2007

A co-worker of mine shared this with me recently.  It was one of the biggest annoyances in Visual Studio 2005 if you ask me!

How to enable IntelliSense in .skin files

IntelliSence everywhere! That’s one of the biggest features in new Visual Studio .NET 2005 (VS 2005). But guess what, it doesn’t work out of the box in .skin file  – the place you really need it. Those of you who worked with ASP.NET 2.0 themes understand me . Good news – there is a workaround to enable this feature. Do the following:

1. Go to Tools->Options menu.

2. Pick Text Editor -> File Extesion fom a tree at the left part of Options dialog.

3. Type skin in Extesion text box.

4. Select User Control Editor from Editor dropdown.

5. Click Add and then Ok to close dialog and re-open your skin files.

6. Say something corny about Microsoft.

Enjoy!