Pop Up Window refresh parent

HTML, JavaScript No Comments »

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();
}

Sitefinity Custom Download List

.Net No Comments »

Problem: create a file-download-list that you can filter by tag, category, or other criteria

Solution:

  1. create a library and upload your files to it
  2. categories and/or tag the files the way you want them to be filtered
  3. 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)
  4. 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.

Fix ASP.net menu in Safari and Chrome

.Net, HTML No Comments »

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

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in