var date = String.Format("{0:yyyy-MM-ddTHH:mm:ss.fffffffZ}",
dateObjectToFormat);
This produces a date in this format in Solr:
Check out this documentation on the Solr date formats.2010-03-09T00:00:00Z
Web application R&D notes, from the world of Java, Flex, CSS, XHTML, Flash, .NET, cross-browser compatibility, JavaScript, AJAX, ADA compliance, Photoshop, and any and all things related to Web development!
var date = String.Format("{0:yyyy-MM-ddTHH:mm:ss.fffffffZ}",
dateObjectToFormat);
This produces a date in this format in Solr:
Check out this documentation on the Solr date formats.2010-03-09T00:00:00Z
html>/**/body .my-css-rule-name {
/* some CSS */
}Thanks to David Hammond's CSS Hacks page.
#main-content ul{ margin-left:0 }
The solution? Use the hack to reference only IE7 (the hash tag):
#main-content ul{
margin-left:0;
/*
The next two lines are only visible to IE7. This fixes the
issue of IE7 not showing the bulleted items; they were
flushed left so far that the bullet was mostly hidden.
All other browsers ignore the next two lines.
*/
#margin:0 5px 0 42px !important;
#padding:0;
}
protected override void OnLoad(EventArgs e)
{
// To ensure page behaves correctly, must call base.OnLoad(e).
base.OnLoad(e);
GetRootTitle();
}
private void GetRootTitle()
{
string title = string.Empty;
/*
On admin pages, this label object doesn't exist and will throw
a NullReferenceException if we don't check it before trying
to use it.
*/
if (sectionTitle == null) return;
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
title = IterateThroughParentsAndStoreInfo(web, title);
}
}
sectionTitle.Text = title; // Set a label's value to the title.
}
private string IterateThroughParentsAndStoreInfo(SPWeb web, string title)
{
if (web.ParentWeb != null)
{
title = web.Title;
return IterateThroughParentsAndStoreInfo(web.ParentWeb, title);
}
return title;
}
Note the using statements; these ensure there are no memory leaks by disposing of the objects properly and also implicitly handling the try/catch/finally block. The change to W0ut's code is the addition of the OnLoad() handler, which can be either in your master page or page layout. Also, we've added the title variable, which gets set in the recursive function; note that its value is always of the title for the site one before the last. This is because when the web variable's ParentWeb becomes null, we've reached the site collection. This is exactly what we need.<script type="text/javascript">
// Replace the normal jQuery getScript function with one that supports
// debugging and which references the script files as external resources
// rather than inline.
jQuery.extend({
getScript: function(url, callback) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = url;
// Handle Script loading
{
var done = false;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if ( !done && (!this.readyState ||
this.readyState == "loaded" || this.readyState == "complete") ) {
done = true;
if (callback)
callback();
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
}
};
}
head.appendChild(script);
// We handle everything using the script element injection
return undefined;
}, // <-- Unneeded comma which blows up IE7.
});
</script>
IE7 blows up with this error:Error: Expected identifier, string or numberIt took quite a bit of debugging and Google searches to finally understand where the problem was. Note the last comma, after the next-to-last closing curly brace "}," -- this is unnecessary. Modern browsers can handle this, but IE7 chokes. Simply remove the comma and you're good to go. More on this problem on Stack Exchange.
.hide-tr { display:none; }
The problem develops when you later wish to show the row; simply setting the display to block is insufficient, as the individual cells in the row lose their positions and often get bunched next to each other. Using display:table-row works on most modern browsers, but IE7 ignores that and prefers display:inline-block. So the solution? There are a few ways to fix the problem, as indicated on Stack Exchange.
The problem with using visibility:hidden is that the row still takes up space on the page and shrinking its height is a non-trivial task. Another solution involves a method less recommended, using browser and version detection via jQuery. However, it does fix the issue:if ($.browser.msie && jQuery.browser.version == '7.0'){
$('.hide-tr').css('display','inline-block');
}
else {
$('.hide-tr').css('display','table-row');
}
Not a clean solution but it gets the job done :)