I gave my presentation today at SharePoint Fest in Denver. Here’s the PowerPoint presentation itself: http://www.mstechblogs.com/paul/wp-content/uploads/2011/05/SharePointFest.pptx
Follow me on Twitter at http://www.twitter.com/pagalvin
|
||||||
|
I gave my presentation today at SharePoint Fest in Denver. Here’s the PowerPoint presentation itself: http://www.mstechblogs.com/paul/wp-content/uploads/2011/05/SharePointFest.pptx Follow me on Twitter at http://www.twitter.com/pagalvin This seems like such an oddball topic, I’m not sure it’s really worth blogging about, but that’s never stopped me before, so here we go I’m working out on a project where I’m pulling some data from a search, packaging it up into an XML message and then that XML is ultimately transformed into HTML via XSLT. There’s a lot of jQuery involved, one bit of which implements some tabbing functionality. When you click on a tab (really, a <div>), jQuery invokes .hide() and .show() on various divs (the initial page load downloads all the content so there are no postbacks in this case). A bunch of hours ago, the tab switching logic started to behave erratically and it wouldn’t show one of my tabs. I ultimately tracked it down to the fact that internet explorer (at least) thought that the <div> tags nested far, far deeper than intended.The developer toolbar would show:
So, if I did a $(“#Tab1Content”).hide(), I’d also hide Tab2 and I could never show Tab2 if I didn’t also show Tab1. I copied and pasted the code up into visual studio and it showed all of the div’s lining up nicely, just like they were supposed to be doing, looking like this:
I beat my head against the wall for a while and noticed that in the actual HTML code was generating a lot of empty <div> tags, like:
(The above is waaaaaaaaaaaay oversimplified. The empty div tags are totally valid. Some of my <div> tags were full of content, but many more were not. I came to the realization that my <xsl:for-each> directives were emitting the short-form div tags when the xsl:for-each didn’t’ find any data. I forced an HTML comment into the output, as shown:
After I did that, all the div’s lined up nicely and my tab switching started working. As always, I hope this helps someone in a pinch. </end> Follow me on Twitter at http://www.twitter.com/pagalvin I’ve been spending some time cleaning up a SharePoint 2010 site and one of the cleanup issues relates to a corrupt / incorrectly installed SQL Server Report Services issue. The issue arose when one of my colleagues tried to save a site as a template and then create create a new site based on that template. The save operation worked fine, but when she tried to create the new site, SharePoint displayed the following error message:
Here’s a screen cap:
I had a look at the content types in the site and found this: Those content types are clearly unhealthy. This issue seems to come up a lot on the Internets and there doesn’t seem to be a single consensus on how to solve it. I found a handy table that mapped the bad content type names to good content type names here: http://social.technet.microsoft.com/Forums/en-ZA/sharepoint2010programming/thread/cb03e866-8184-4943-acfe-cafffa1b8b7a. I manually updated them thusly: (BrightStarr in the name is obviously optional, but it can’t hurt This allowed me to create a new template and didn’t break anything on the other sites, including some PerformancePoint Server stuff that a completely different group of people were working on. I was then able to create a new site on the template. Success! I am not sure this is a 100% solution, but it got me and everyone involved past this annoying error. If I find anything new, I’ll post an update. My nervousness stems from the fact that these names shouldn’t be wrong in the first place and by fixing the display name, I am not touching the internal name. </end> Follow me on Twitter at http://www.twitter.com/pagalvin I’ve been doing a lot of work with SharePoint search lately and specifically the KeywordQuery class, properties and methods. If you want the result set to return results above and beyond the usual suspects (see here), you add it to the SelectedProperties collection, as in:
Many thanks and a tip of the hat to Corey Roth and this enormously helpful blog post (http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/19/how-to-use-the-moss-enterprise-search-keywordquery-class.aspx) In my case, “xyzzy” isn’t actually a managed property. When I added it to SelectedProperties anyway, SharePoint threw one of my favorite ever runtime exceptions:
I especially like the capital “R” in Reason. This sounds to me like the .NET equivalent of “I have no mouth, and I must scream.” </end> Follow me on Twitter at http://www.twitter.com/pagalvin When you invoke the Execute() method on a KeywordQuery, you can create a ResultTable based on ResultType.RelevantResults. This code snippet illustrates what I mean:
The resulting table will have the following columns of information:
I derived this list from a SharePoint 2010 environment, enterprise edition. Hopefully it will be handy to someone in future. </end> Follow me on Twitter at http://www.twitter.com/pagalvin While working on a visual studio web part project today, I did a minor re-org of some files to be put into the _layouts folder as part of the deployment process. Specifically, I renamed a .js file from “TypeAhead.js” to “TypeAhead(old).js” I plan to remove it as soon as its successor “TypeAhead.js” proves correct. It looked like this: This immediately caused a problem with visual studio when I tried to deploy the project:
It turns out that you should not put a parenthesis in file names. I removed the parens and that solved the problem. </end> Follow me on Twitter at http://www.twitter.com/pagalvin I inherited a web part from a client’s old vendor and it has an image size problem. The images should be 60×50 but for some odd reason, the original vendor forced them into 42×42, so they look squashed:
Here’s the markup (somewhat simplified):
You’ll note that even though the path to the image itself shows the proper dimension (60×50) the original vendor forced it in 42×42. Why? Crazy. Anyway, I wanted a quick and easy solution to this issue and I turned to jQuery. The trick was to locate all of the appropriate <img> tags. I didn’t want to muck about with any other img tags (of which there are many). This bit of jQuery did the trick:
That bit of code finds the collection <li> tags whose class is “condition” and <img> children. It then iterates through all of that. Worked like a charm. I could probably streamline it, but I never was a the kind of unix guy that solved π to 18 digits precision using sed and awk and I’m not that kind if jQuery guy either </end> Follow me on Twitter at http://www.twitter.com/pagalvin Here’s a quick example using LINQ to parse some XML and get at the sweet, sweet attributes therein. Here’s the XML I want to parse:
I want to build up some tabs at runtime by parsing the above. My tabs depend upon a page layout. If my page layout’s name is “xyzzy2” then I want to get tabs 100, 101 and 103 (the tabs in <PageLayout name=”xyzzy2”>). Here’s the LINQ that does it:
In the above, the variable “theXmlToParse” is a string variable, but you can use the load() method on a stream if you like. “Results” is a label on a web form and when this code executes, it looks like this: I haven’t worked out how to sort the results yet, so I’ll leave that for a future blog post. </end> Follow me on Twitter at http://www.twitter.com/pagalvin |
||||||
|
Copyright © 2012 Paul Galvin's SharePoint Space - All Rights Reserved |
||||||
Popular posts