Thursday, February 14, 2008

Connecting to an Access Database in Visual Studio 2008 Server Explorer

Trying to connect to an MS Access DB from the visual studio 2008 Server Explorer gave me a little surprise to see that the window I got to create the connection only gave me the possibility to type in the connectionstring myself.

Trying several possibilities, the test connection button always cleamed the connection was OK, but when clicking OK i received the following message :

format of the initialization string does not conform to specification starting at index 0
After a long search, the solution was found, something is incorrect in the registry :
- Open the registry using regedit
- Find the  "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}"  in the tree
- Check if there is a subkey named ProgID there, if there is, you are not having the same problem as I had, but be sure to check the value

If the key is not there, add it :
- Right click the node and click new, key
- Name it ProgID
- Select the newly created key
- In the main (right) pane, doubleclick the "(Default)" value
- Set its value to "MSIDXS.1" (without the quotes ofcourse).

Now when you create a new connection to an access DB, you can use the correct window.

Tuesday, February 12, 2008

Clearing an Infragistics WebDateChooser

Clearing an Infragistics WebDateChooserThe infragistics webdatechooser is a very handy control for your website, easy to use and, as all infragistics controls, very configurable.

The only problem is when you filled in a value and want to empty the value, it retains the previously selected value. To really set the value to null, we can use its EditKeyUp event and a little javascript :

Change the control definition to (controlnames have been altered to protect the innocent) :
<igsch:webdatechooser id="wdcMyChooser" runat="server">
...
<clientsideevents editkeyup="webDateChooser_EditKeyUp">
<igsch:webdatechooser>


The name was kept generic, so that this function can be used for more than one webdatechooser on a page (or in an external javascript file or … )


Now all we have to do is add the Javascript function :

function webDateChooser_EditKeyUp(oDateChooser, keyCode, oEvent)
{
if (oDateChooser.getText() == "" oDateChooser.getText() == null)
{
oDateChooser.setValue(null);
}
}

And that is all there is to it, when the user clears the text from the wdc, the value inside is also cleared. At a postback we get the null value we wanted.