Tagged Posts

Learn how to access your SmugMug sitemap URL when using a custom domain. This comprehensive guide covers the importance of sitemaps for SEO, step-by-step instructions for setting up your custom domain, and how to find and submit your sitemap to search engines like Google and Bing. Whether you're a professional photographer or a hobbyist, ensuring your SmugMug site is easily discoverable by search engines can help attract more visitors to your stunning photo galleries. Enhance your website's visibility and SEO with these simple yet effective tips.

I was trying to do some work with the Form and List module in DotNetNuke today and I needed to apply some custom styles to the LIST view of a module, without going in and creating a full XSL template for the module to use, I wanted to style the default table based grid view.

In order to customize this view though I needed to do some custom jQuery that runs after the table is loaded, the jQuery then goes through and looks for columns, and based on the number of columns, adjusts the way those columns display.

First I wanted to make it so that a specific column didn’t have text wrapping, which in HTML would normally use the nowrap property on a column, but because of the dynamic nature of F&L you can’t configure that manually. To achieve this I needed to loop through each Table Row (TR) in the table, and then find the column in question, and apply the css attribute/value for white-space/nowrap. To do this I used code like the following.

$("#tableId tr").each(function(){
    var cellCount = $(this).find("td").length;
    if(cellCount==4)
    {
        $(this).find("td:eq(0)").css("white-space","nowrap");
    }
    else
    {
        $(this).find("td:eq(1)").css("white-space","nowrap");
    }
});

Basically that goes through and finds each row in the table, then checks to see how many columns there are. I do this because the VIEW for the table when you are logged in, versus when you aren’t logged in, is different, the F&L module adds an Edit column at position 0, so you can see in the ELSE statement I basically want to set the width on the 2nd column, position 1 in the zero-based array.

If you want to do something similar for the HEADER row of the table you have to do things slightly differently, using the following code

$("#tableId tr:eq(0)").each(function(){
    var cellCount = $(this).find("th").length;
    if(cellCount==4)
    {
        $(this).find("th:eq(0)").css("text-align","left");
        $(this).find("th:eq(1)").css("text-align","left");
    }
    else
    {
        $(this).find("th:eq(1)").css("text-align","left");
        $(this).find("th:eq(2)").css("text-align","left");
    }
});
So there you go, you can use that jQuery above to go through and make changes to columns in an HTML table, depending on the location of the cell.
DotNetNuke Tip #17, Disable Inline Editing in Text/HTMLWith the latest releases of DNN, 3.3.* and 4.3.*, you may notice that when logged in to a page you have edit rights to that you can "edit" content in the text/html modules simply by clicking on them in the browser window and typing. Convenient, yes? Sometimes! Othertimes it can really be a pain in the rear, I'm a click happy person, I click places so I can get my scroll started, so that last thing I want is to begin editing content on my pages.I figured I'd post a solution to disable this option in DNN. Currently this requires a recompile, though I know the core team is looking at how to make this an option for the Text/HTML module.So here's what you need to do.Download the Source Version of the Text/HTML project from DotNetNuke.comOpen the Project in VS 2003, I opened it in an existing DNN solution I had setup already.Open the HtmlModule.ascx.vb fileAround line 196 you'll find the following codelblContent.EditEnabled = Me.IsEditableComment that line out and add the following line'lblContent.EditEnabled = Me.IsEditablelblContent.EditEnabled = FalseRecompile the module in release mode and use the newly created DLL in your environments. Always Test new code/dlls on a test instance before moving them into production. The above code worked fine for me, but please test for yourself first.Stay tuned for more DotNetNuke tips, brought to you by Chris Hammond from Engage Software. Posted from...
RSS URL

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.