asp:DeclarativeCatalogPart WebPartsTemplate must have odd number of elements

I discovered an interesting anomaly today, working with ASP.NET and Web Parts, I had an issue whereby creating a CatalogZone caused the HTML generated from template to lose a whole lot of closing tags. This threw the whole page out the window as the CSS was stuffed. I did a LOT of Googling to no avail.

Finally I went into the tried and true method of trial and error; removing one element at a time until I found the problem bit. This was also anomalous as I have three pages with essentially the same code and only one breaks! I won’t bore you by going through every iteration and step I took, I’ll just bounce to the solution.

In their wisdom Microsoft has apparently made the template work for an odd number of elements, but an even number has a tantrum and is not composed correctly. It was only when I realised that that during my trial and error, the two working pages had 15 and 5 elements respectively, and the “broken” page had 6 elements; thinking this could not possibly be the issue, I checked and was astounded. The general response from my colleagues was “you’ve got to be f@$#en kidding me”. I swear, I’m not.

In summary, from an HTML point of view, this works:

<asp:CatalogZone ID="CatalogZone" runat="server">
	<ZoneTemplate>
		<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart" runat="server">
			<WebPartsTemplate>
				<tfr:stuff1 ID="stuff1" runat="server" />
				<tfr:stuff2 ID="stuff2" runat="server" />
				<tfr:stuff3 ID="stuff3" runat="server" />
			</WebPartsTemplate>
		</asp:DeclarativeCatalogPart>
		<asp:PageCatalogPart ID="PageCatalogPart" runat="server" />
	</ZoneTemplate>
</asp:CatalogZone>

and this doesn’t:

<asp:CatalogZone ID="CatalogZone" runat="server">
	<ZoneTemplate>
		<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart" runat="server">
			<WebPartsTemplate>
				<tfr:stuff1 ID="stuff1" runat="server" />
				<tfr:stuff2 ID="stuff2" runat="server" />
			</WebPartsTemplate>
		</asp:DeclarativeCatalogPart>
		<asp:PageCatalogPart ID="PageCatalogPart" runat="server" />
	</ZoneTemplate>
</asp:CatalogZone>
Advertisements

next post, my fail, Kanye’s a f%$#tard

First off the bat, I didn’t make it through to Round 2 of CodeJam. The issue I posted about on Saturday reared it’s ugly head again and I kept getting the good old crash due to int not handling 10^18 !! Annoyed me a tad, so I haven’t reviewed my attempts just yet. My small datasets worked perfectly with the identical code, so I’m definitely puzzled. I’ll be posting the code once I have the issue solved. I’ll then be able to point out my epic fail that should have been obvious. Ah well, next year I’ll be back in for more. I’m also contemplating doing it in PHP next time instead of C# because I like the cleanlines of some of the algorithmic features of PHP. I’ve reviewed other competitors solutions in PHP and C# also; the other biggie for me is to review my regular expressions as I don’t use them anywhere near enough, so my code is full of while loops/if-else statements etc.

Moving on, I have to say that Kanye West is a “moustache on a woman” (thanks Paul Henry!!) for his efforts at the VMAs the other night. All the copies of the video keep getting pulled from YouTube, so the best I can offer is this link to mashable. Suffice to say, he’s acting like an arrogant douche and jumps into the middle of Taylor Swift’s acceptance speech to grab the mic and say he thought Beyonce should win!! He got booed off by the crowd, but even so he needs a big slap upside the head.

The video has also been remixed already too:

Other than that, I’m loving MonoTouch!! It’s an interface and IDE essentially which enables you to run your .NET and ASP applications within the iPhone/iPod Touch framework. From the website:

MonoTouch is the Mono edition for Apple’s iPhone and Apple’s iPod Touch devices.  MonoTouch allows developers to create C# and .NET based applications that run on the iPhone and can take advantage of the iPhone APIs as well as reusing both code and libraries that have been built for .NET as well as existing skills.

For example, here is the proverbial “Hello World” demo. So simple and sweet. I definitely want!

That’s enough for right now, but I’ll bring more later today, as well as some updates on launching site in the next few days. 99% done, just final testing now.