Thursday, February 24, 2011

How to change the title of a jquery dialog

Here is an image that a user can click to get help

   <img src="/Content/images/Help.png" style="cursor:pointer" onclick="javascript:ShowHelp('My Title')" />

Here is the jquery dialog

   <div id="dialog-help" title="" style="background:white">
      <div id="divHelpContents"></div>
   </div>

Javascript function to set up the dialog

      $(document).ready(function ()
      {
         //Help popup
         $("#dialog-help").dialog({ autoOpen: false
            , modal: true
            , width: 415
            , height: 300
            , show: "blind" //animation effect
            , hide: "clip" //animation effect            
            , draggable: true
            , resizable: false
            , buttons: {
               Ok: function ()
               {
                  $(this).dialog("close");
               }
            }
         });
      });
Here is a function that will update the title, help contents, and open the dialog
      function ShowHelp(topic)
      {
            $("#dialog-help").dialog('option', 'title', topic);
            $("#divHelpContents").html("Show some help contents here");
            $("#dialog-help").dialog("open");
      }

Friday, February 18, 2011

How to get paste to work with Remote Desktop Connection

You can copy things to the clipboard and paste them into your remote desktop connection.

What do you do when paste stops working ?

1.  Close your remote desktop connection (you don't need to log out).

2.  Reconnect.

How to re-insert deleted records when there is an identity field

My customers like to delete important records and then have me restore them from a backup when they realize their mistake.

When the column has an identity field, and you want to restore the records with the same number as they had before deleted, you must turn on identity insert with this TSql command

SET IDENTITY_INSERT {YourTableName} ON 

insert the deleted records

SET IDENTITY_INSERT {YourTableName} OFF