The two poll boxes on the masterpage require that a poll exist in the DB with the following property values: 'PollID'=24 (hard coded in the 'More Polls' box), and 'IsCurrent'=True (loaded by the 'Current Poll' box). You will need to add at least one poll to the DB with these values in order for TBH to run properly. Because you cannot set the poll ID manually, you will still get a fatal error when the 'More Polls' box looks for a PollID=24. Add the following code to the 'GetPollByID()' function (Poll.vb
) to check for a valid poll object, if it is null it returns the current poll instead. This code also prevents the error that occurs adding a pollbox that has an invalid PollID to a WebPart.
' Returns a Poll object with the specified ID
Public Shared Function GetPollByID(ByVal pollID As Integer) As Poll
Dim poll As Poll
Dim key As String = "Polls_Poll_" + CStr(pollID)
If BasePoll.Settings.EnableCaching AndAlso Not IsNothing(BizObject.Cache(key)) Then
poll = CType(BizObject.Cache(key), Poll)
poll = GetPollFromPollDetails(SiteProvider.Polls.GetPollByID(pollID))
'FIX - check for invalid PollID
If IsNothing(poll) Then
poll = CurrentPoll 'use current poll if requested poll is invalid
key = "Polls_Poll_" + CStr(CurrentPollID)
Additionally the user should not be able to delete the current poll. Also, a dropdown list of existing polls to select from when adding a pollbox in a WebPart would also prevent invalid ID's from locking up the site.