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:
- Grab the SPWebPartCollection from the current SPWeb (through a url to a Web Part Page I create which has an XmlWebPart on it)
- Find the XmlWebPart on the page by walking through the SPWebPartCollection and matching up on GetType or something
- Set the Xml (or XmlLink) property once the XmlWebPart is found
- 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.