XmlWebPart ala carte

The WebPartPages namespace and the various Web Parts that Microsoft has in them keeps puzzling me. While everyone is off at TechEd, some of us still have work to do (yeah, that was today's grumbling).

I had previously tried to instantiate my own copy of a ListFormWebPart (because it's sealed so I can't inherit from it) and wrapping it up in my own custom Web Part. This failed miserably so here we are again. Now I'm bugged by the XmlWebPart. It's a great Web Part for rendering Xml without having to build your own XmlDocument and do transformations and all that jazz. Just set the Xml (or XmlLink) property and optionally the Xsl (or XslLink) property and voila, insto no-nonsense Xml rendering. Trouble is that I can't seem to do this on the fly. The Xml links have to be static.

The best compromise I can find is to:

  1. Grab the SPWebPartCollection from the current SPWeb (through a url to a Web Part Page I create which has an XmlWebPart on it)
  2. Find the XmlWebPart on the page by walking through the SPWebPartCollection and matching up on GetType or something
  3. Set the Xml (or XmlLink) property once the XmlWebPart is found
  4. Redirect the user to the custom Web Part Page for happy viewing

Or maybe I'm just trying to beat a dead horse and should just do my own dang transformation? I know Microsoft has to use the WebPartPages for their own Web Parts but why is it so difficult for anyone else to just tap in and leverage them?

Man, a week without TechEd (and the bright Orlando sunshine) and it's been raining for a few days here in Cowtown. Sucks to be me.

1 Comment

  • In a way I'm looking forward to this year NOT having to break off my Helsinki summer (short at the best of times) for a week at the beginning of July for TechEd Europe.

    The plan is to spend most of my free time that week kayaking instead of spending 7-20 days indoors - probably actually most of the days as I'm likely to be on holiday.

    However if it rains all week I too will no doubt be regretting not spending my time with the MVP support crew and the other MVPs in Amsterdam.

    So a fellow sufferer? We'll see what the weather's like.

Comments have been disabled for this content.