Mar 04
If you have a script that opens up a new window using JavaScript: window.open()
on the child window, if you want to close the window and refresh the parent window, use the following code:
window.close();
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}
Mar 03
Problem: create a file-download-list that you can filter by tag, category, or other criteria
Solution:
- create a library and upload your files to it
- categories and/or tag the files the way you want them to be filtered
- download the following sample code from the Telerik team:
http://www.sitefinity.com/ClientsFiles/143126_customdownloadlist.zip
(for more information on this download refer to Telerik’s forum)
- add the following customizations to the supplied sample in order to filter by tags or categories:
if (filterByTag)
{
tagFilter = new List<ITag>();
IList<ITag> alltags = this.manager.GetTags().OfType<ITag>().ToList();
foreach (Guid g in FromTags)
{
foreach (ITag t1 in alltags)
{
if (t1.ID.Equals(g)) { tagFilter.Add(t1); }
}
}
}
if (filterByCategory)
{
categoryFilter = new List<ICategory>();
IList<ICategory> allcats = this.manager.GetCategories().OfType<ICategory>().ToList();
foreach (Guid g in FromCategories)
{
foreach (ICategory c1 in allcats)
{
if (c1.ID.Equals(g)) { categoryFilter.Add(c1); }
}
}
}
now you have a custom download list that filters by Tags or Categories.
I have only tried this code on a Sitefinity 3.7 Standard site, I don’t know if it is compatible with other versions.
Mar 03
If you use the standard ASP.NET menu (or toolbar) in your web application, it works well in most browsers except for Safari & Chrome. In these 2 browsers, each menu item appears on a new line.
The fix I found was placing the following code in my MaterPage code-behind:
if (Request.UserAgent.IndexOf(“AppleWebKit”) > 0)
{
Request.Browser.Adapters.Clear();
}
If you are not using a Materpage:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.UserAgent != null && Request.UserAgent.IndexOf(“AppleWebKit”, StringComparer.CurrentCultureIgnoreCase) > -1)
{
this.ClientTarget = “uplevel”;
}
}
The solution is adapted from this site (Thank you):
http://weblogs.asp.net/joshuajohnson/archive/2008/01/23/how-do-i-overcome-the-dreaded-safari-asp-net-menu-conundrum.aspx
Recent Comments