Wednesday, April 23, 2008

How to install Windows SharePoint Services 3.0 Tools to XP or Vista

Another blog ripoff, this time from Janne Mattila, on how to trick XP or Vista machines into thinking that WSS 3.0 is installed so that you can install WSS 3.0 Tools for Visual Studio 2005:

http://blogs.msdn.com/jannemattila/archive/2007/08/16/how-to-install-windows-sharepoint-services-3-0-tools-to-xp-or-vista.aspx

Details: it's a registry hack...

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0]
"Sharepoint"="Installed"

Tuesday, April 22, 2008

How to Create a MOSS 2007 VPC Image

Wonderful series of posts by Tony Zink outlining exactly what you need to do to set up Microsoft Office SharePoint Server 2007 on a Virtual PC with a SQL Server 2005 backend and full e-mail capabilities:

http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=28

Thursday, April 3, 2008

LINQ to SQL and the DataGridView control

A DataGridView control won't bind directly to an IEnumerable object, so two options are:

1. Create a BindingSource, set its DataSource to the IEnumerable object, then set the DataGridView.DataSource property to the BindingSource.

2. Bind the DataGridView.DataSource property to the IEnumerable object's ToList() method.

Thanks to Ken Tucker on Microsoft Forums for this tip.

Monday, March 3, 2008

How to resolve "__doPostBack is not defined" error

Thanks to Julien Pinquié:

When I ran across this, I found that I'd closed a <script> tag referring to an external .js file with /> notation instead of <script></script>; the <script> tag doesn't accept this notation for whatever reason.

Sunday, February 17, 2008

Simple Port Scan

The following function will check to see if connectivity is enabled for a particular host on a particular port via TCP/IP:

Function ScanPort(ByVal strHost As String, ByVal intPort As Integer) As Boolean
    Dim aobjIPs() As System.Net.IPAddress = System.Net.Dns.GetHostEntry(strHost).AddressList
    If aobjIPs.Length > 0 Then
        Dim objEndpoint As New System.Net.IPEndPoint(aobjIPs(0), intPort)
        Using s As New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
            Try
                s.Connect(objEndpoint)
                Return s.Connected
            Catch ex As Exception
                Return False
            End Try
        End Using
    Else
        Return False
    End If
End Function

Thursday, January 31, 2008

JavaScript button disable with postback

When an ASP.NET server-side button is given client-side JavaScript code to execute when handling onclick, the button no longer posts back by default. However, there is a small piece of code you can add to the onclick attribute of the button to re-enable the postback behavior.

Adding this code in the Page_Load method will remove a server-side button's postback call:

btnConfirm.Attributes.Add("onclick", "Confirm_Click();")

But writing the code like this will reinstate the postback call:

btnConfirm.Attributes.Add("onclick", "Confirm_Click(); " + ClientScript.GetPostBackEventReference(btnConfirm, ""))

FileUpload control in an UpdatePanel

By nature, FileUpload controls require an entire page postback to submit the file contents, so they are explicitly excluded from support within an UpdatePanel...however, if you put the Submit button that performs the postback intended to upload the file into a PostbackTrigger, you can place your FileUpload control within the UpdatePanel.


<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:FileUpload runat="server" ID="fupTest" />
        <asp:Button runat="server" ID="btnSubmit" Text="Upload"/>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="btnSubmit" />
    </Triggers>
</asp:UpdatePanel>