Travails of an ungeeker

Friday, May 12, 2006

ASP.NET validator controls throw an Exception in MCMS by default

If you add an ASP.NET validator to an MCMS template you get a strange error like: MCMS Object has been deleted. An attempt was made to access the properties or methods of an object that was deleted by the current session.

First you'll find that a service pack for MCMS 2002 SP1a exists but which Microsoft discourages you from installing. Taking their advise and looking further you will find that the problem lies with the Web Author Console, where the standard processing of validator controls is not enabled by the default. Perhaps the service pack fixes that, but here is another way:

You can buy Stefan's book or just look at a posting from him here which shows the required code to add to make ASP.NET custom validation controls work.

http://www.gotdotnet.com/Community/UserSamples/Download.aspx
?SampleGuid=65F90778-465D-4A98-804F-2CCA72FF4704


There you will see you that you need to add some code to the AuthoringSaveNewAction method called by the Author Console. In your derived method, inject a call to Page_ClientValidate() which enables the validation support. That's for a new page save, so similar is requierd for AuthoringReeditSaveAction() and AuthoringReeditSaveAndExitAction().



Overriding the AuthoringSaveNewAction() of the console you need to inject a call to
if (this.Page.Validators.Count > 0) {
strReturn += "if (!Page_ClientValidate()) return false; ";
}

Wednesday, May 10, 2006

ScreenHunter 4.0 rave review

These days I don't use many shareware utilities, but ScreenHunter is really a great screen capture / print screen replacement tool. It is especially useful for web-based user manuals because at the same as putting the image on the clipboard, it also creates a GIF (or JPG) file to use.

Other good features are: capture of the mouse pointer and tool tips (handy for marking a button of interest etc), and the rectangular copy, which is the main thing that Windows Print Scrn lacks.

Fix search problem in Articles module (for DotNetNuke) from Efficion Consulting

First of all a prefix is warrented: this is a great module and does basically everything that our client wanted for news publishing, including the requirement for adding a separate archive page. It does this without having lots of complicated to set up options. Best of all, it's Free. Thanks Efficon.

However there is a problem with Search (the normal site search) if you do not use the categories feature in that none of your entries are ever matched during a search. At first it seemed that the ISearchable interface was not implemented (to tell DotNetNuke how to index the entries), however it is implemented.

I was very impressed with their support. We had some emails and they even logged onto our application server to have a look. However in the end the problem was only solvable by looking on the SQL Server, by running a SQL profiler trace, one call looked interesting:

exec dbo.Articles_GetArticles @PortalID = 25, @ModuleID = 3101, @Categories = NULL, @MaxNumber = 500, @Age = -1, @ShowAuthOnly = 1, @Featured = 0, @IgnorePublishDate = 0, @IgnoreExpired = 0, @SortField = 'CreatedDate'


This returned no rows. Trying this in SQL Analyer with @Categories = 0 did. Therefore you can add the T-SQL code below to the stored procedure Articles_GetArticles to implement a workaround without having to recompile the source. I am blogging this because despite initial helpfulness, I have had no response to my request that they confirm my fix (seems to be good) and implement this or a better one into their code.
if (@Categories is null)
begin
set @Categories = 0
end