RepeatHost Business Hosting
  • Fixing Relative Paths in C# ASP.NET When Using Url Rewriting

    UPDATE: This method is generally used in situations where you have relative paths in your project so that links (image, href, css, etc) work on your development environment (where the VS web server inserts a virtual path), as well as your production environment that may or may not have that same virtual path.  The simpler way to handle this situation is to change the virtual path in your development environment.  To do this, click on your web site project and look in the properties dialog.  You should see a Virtual Path setting.

  • Ajax - Exception has been thrown by the target of an invocation

    If you're working with Ajax in .NET, you'll probably see an exception like this at some point:

    Exception has been thrown by the target of an invocation

    Not very helpful.  What you need to do is tell the ScriptManager to catch post back errors and re-throw the InnerException.  Change your ScriptManager to look like this:

        <asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError">
        </asp:ScriptManager>

  • Web.config Settings Editor Control

    This control provides a "drag and drop" way to dynamically view and edit application and database connection settings in a Web.config file for an ASP.NET website. The control can be dropped onto a blank ASPX page and by default, it will display editable controls for all the settings in the <appSettings> and <connectionSettings> sections of the Web.config file.

  • Add a Composite Control to the Visual Studio Toolbox

    When you create your own custom control or want to add a control from a DLL that contains one or more controls, to use the control by just dragging and dropping it onto an ASPX page is to add it to your Visual Studio Toolbox. The easiest way to do this is to open your "slide out" toolbox in Visual Studio. It should looks something like this:

  • Fix for Visual Studio 2008 SP1 Design Mode Error - [text] could not be set on [property]

    When building a custom / web / composite control in Visual Studio 2008 SP1, once you have a custom property that you attempt to set in design mode, you will see an error similar to this in design view: There was an error rendering the control. [value] could not be set on property [property name] The way to duplicate this error is to set a property from the designer on your control, then right-click the control and choose "Refresh" or just close the hosted ASPX page and re-open in design view. Either way, you will see this error.

  • How to Highlight the Day in the ASP.NET Calendar Control with the SelectedDate Property

    When you add an ASP.NET Calendar control to a page that might support edit capabilities, you may want to show the existing value in the Calendar control on post-backs. If you look into this, you'll probably notice the SelectedDate property of the control. This sets the date that is is selected in the control. So doing something like this, you might expect that the control would show the day highlighted automatically:

    // set the selected date of the calendar control

  • Compare SQL Databases

    From time to time, I’ll run into a situation where I need to compare database schemas or data from two different databases. This usually happens when a developer makes changes to a development database and neglects to keep track of those changes. When the time comes to push to production, it’s hard to remember all of the changes and if something ends up getting left out, you have to spend time tracking down what was missed.

    This use to happen to us a lot until we started using scripts to create and update databases.

  • MySQL Administrator - Can't see with Remote Desktop session connecting to Multiple Monitor Workstation

    I have a Vista workstation at work with 3 monitors. At home I have a laptop running XP. I commonly remote desktop into work and some of my programs will be running and visible in the task bar (e.g. Outlook, MySQL Administrator, etc...) but the actual window of the program will still be on my left or right monitor at work. So at home, it is not visible.

    With a program like Outlook, it is an easy fix.
    - Right Click the program in the task bar.
    - Select Move.
    - Use the left or right arrow key to move the running program so that it is visible in the remote desktop session.

  • ASP.NET CSS Highlight TextBox on Focus

    Many sites have a useful visual way to show the user what TextBox (input text control) is currently focused or selected by highlighting the background of the control with a color such as yellow. When you tab or click into the TextBox, the border and background usually change to denote it has focus.

    Here is what the TextBox should look like when it is focused and unfocused after applying this trick:

    Un-Focused TextBox
    unfocused textbox

  • Create trigger MySQL 5.0 - super privilege required

    In one of our C++ applications we programmatically create and write a trigger to the database. The application is designed to connect to Microsoft SQL Server, Oracle and MySQL 5.0.

    When connected to MySQL 5.0, when the code attempted to create the trigger the following error was returned:

    ERROR 1227 (42000): Access denied; you need the SUPER privilege for this operation

    To grant the super privilege to the MySQL user, use the MySQL Query browser and connect to the database that the user needs super privilege. Then execute the following command:

    grant super on *.* to Tim