Daily Archives

Articles indexed Sunday March 14 2010

Page 12/89 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • problem when cloning jQuery UI datepicker

    - by h3
    I have a div in which there is a datepicker. I use something like this to clone it: mydiv = $('#someDiv'); // works fine so far mydiv.find('input.datefield').datepicker(); // clone without the events and insert newDiv = myDiv.clone(false).insertAfter(myDiv); // datepicker won't re-init if this class is present newDiv.find('.hadDatepicker').removeClass('hadDatepicker'); // reinitialize datepicker newDiv.find('input.datefield').datepicker(); This is a stripped down version of my code. It works and the calendar shows up as expected where it is expected .. but when a date is clicked, the previous datepicker's value gets updated.. (the one from which it was cloned). I've tried to destroy the (inexisting) instance before like this: newDiv.find('input.datefield').datepicker('destroy').datepicker(); No luck .. I've checked how it keeps track of instances and manually cleared the data like this: newDiv.find('input.datefield').data('datepicker', false).datepicker('destroy').datepicker(); Still no luck. What I don't understand is that only the date selection behavior is buggy, everything else works as expected. I really don't know what else to check now ..

    Read the article

  • ASP.NET MVC 2 throws exception for ‘favicon.ico’

    - by nmarun
    I must be on fire or something – third blog in 2 days… awesome! Before I begin, in case you’re wondering, favicon.ico is the small image that appears to the left of your web address, once the page loads. In order to learn more about MVC or any thing for that matter, it’s better to look at the source itself. Since MVC is open source (at least some part of it is), I started looking at the source code that’s available for download. While doing so, I hit Steve Sanderson’s blog site where he explains in great detail the way to debug your app using ASP.NET MVC source code. For those who are not aware, Steve Sanderson’s book - Pro ASP.NET MVC Framework, is one of the best books to learn about MVC. Alrighty, I followed the article and I hit F5 to debug the default / unchanged MVC project. I put a breakpoint in the DefaultControllerFactory.cs, CreateController() method. To know a little more about this class and the method, read this. Sure enough, the control stopped at the breakpoint and I hit F5 again and the page rendered just fine. But then what’s this? The breakpoint was hit again, as if something else was being requested. I now hovered my mouse over the ‘controllerName’ parameter and it says – favicon.ico. This by itself was more than enough for me to raise my eye-brows, but what happened next just took the ground below my feet. Oh, oh, I’m sorry I’m just typing, no code, no image, so here are a couple of screen captures. The first one shows the request for the Home controller; I get ‘Home’ when I hover over the parameter: And here’s the one that shows the same for call for ‘favicon.ico’. So, I step through the code and when the control reaches line 91 – GetControllerInstance() method, I step in. This is when I had the ‘ground-losing’ experience. Wow, an exception is being thrown for this file and that too in RTM. For some reason MVC thinks, this as a controller and tries to run it through the MvcHandler and it hits this snag. So it seems like this will happen for any MVC 2 site and this did not happen for me in the previous version of MVC. Before I get to how to resolve it, here’s another way of reproducing this exception. Revert back all your changes that you did as mentioned in Steve’s blog above. Now, add a class to your MVC project and call it say, MyControllerFactory and let this inherit from DefaultControllerFactory class. (Read this for details on the DefaultControllerFactory class is and how it is used in a different context). Add an override for the CreateController() method and for the sake of this blog, just copy the same content from the DefaultControllerFactory class. The last step is to tell your MVC app to use the MyControllerFactory class instead of the default one. To do this, go to your Global.asax.cs file and add line 6 of the snippet below: 1: protected void Application_Start() 2: { 3: AreaRegistration.RegisterAllAreas(); 4:   5: RegisterRoutes(RouteTable.Routes); 6: ControllerBuilder.Current.SetControllerFactory(new MyControllerFactory()); 7: } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Now, you’re ready to reproduce the issue. Just F5 the project and when you hit the overridden CreateController() method for the second time, this is what it looks like for me: And continuing further gives me the same exception. I believe this is something that MS should fix, as not having ‘favicon.ico’ file will be common for most of the applications. So I think the when you create an MVC project, line 6 should be added by default by Visual Studio itself: 1: public class MvcApplication : System.Web.HttpApplication 2: { 3: public static void RegisterRoutes(RouteCollection routes) 4: { 5: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 6: routes.IgnoreRoute("favicon.ico"); 7:   8: routes.MapRoute( 9: "Default", // Route name 10: "{controller}/{action}/{id}", // URL with parameters 11: new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 12: ); 13: } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } There it is, that’s the solution to avoid the exception altogether. I tried this both IE8 and Firefox browsers and was able to successfully reproduce the error. Hope someone will look at this issue and find a fix. Just before I finish up, I found another ‘bug’, if you want to call it, with Visual Studio 2008. Remember how you could change what browser you want your application to run in by just right clicking on the .aspx file and choosing ‘Browse with…’? Seems like that’s missing when you’re working with an MVC project. In order to test the above bug in the other browser, I had to load a classic ASP.NET project, change the settings and then run my MVC project. Felt kinda ‘icky’, for lack of a better word.

    Read the article

  • Ideal SEO Package

    Every person who owns a website knows that in order to make a dime out of it he will have to advertise & promote it. Search engine optimization is the most ideal way of promoting a website and generate traffic as well as online visibility for the web site.

    Read the article

  • On Page SEO - The Leap To Google First Page

    Besides your accurate and descriptive content, you also make sure that your title contains at least one tested keyword and a convincing meta-description tag. You could say that when your landing page gets an 85% rating, your SEO job has been completed and you are free to undertake other facets of your e-business that may be waiting for your attention.

    Read the article

  • SEO - The Right Tools For You

    Research has proved that usually a lot of people only visit the page that the search engine has on the top. If you are tired of not getting traffic on your site and want your page to be the first one the search engine optimizes, you can take help of the SEO tools.

    Read the article

  • Website Optimisation - The Impact of Blended Real-time Search So Far

    Despite the initial hype surrounding the introduction of blended real-time search into internet search engines, many experts have begun to question its value to website optimisation. Real time search has been widely criticised as a cause of SERP clutter, making pages appears chaotic and leaving the user struggling to decide which links may actually provide the information they are after.

    Read the article

  • SEO Courses - Tips and Techniques to Enhance Visibility

    Search Engine Optimization (SEO) is the process of optimizing a web site to achieve a higher ranking when a search engine looks for web pages based on particular word or phrase. The SEO courses empower you with the wherewithal to successfully set up and run an optimization program.

    Read the article

  • SEO - Link Building - What You Must Know

    Link building is one of the most basic principles of SEO. Gaining links to your website builds Website Authority and that equals to page rank. Gaining status as an authority website involves a number of factors including trust, relevance and endorsements from other authority websites. Gaining endorsements from other...

    Read the article

  • Few Steps For Making Your Website SEO Friendly

    Currently going by the dynamics of the internet every web designer of class is expected to be acquainted with or have a basic working knowledge of search engine optimization tools. Web promotion as an optimization tool for enhancing increased traffic to a given site is one skill web designers just like online marketers require in their respective fields to conquer the market.

    Read the article

  • Link it Up

    Search Engine Optimization has been widely used as a traffic medium for some time now. Though using it properly can be tricky at times, so do not fall for the tricks.

    Read the article

  • Easy SEO For Beginners

    This may sound surprising but SEO experts find that getting links from other websites is just as important (if not more) as on page factors such as actual content. Imagine that, inbound links more powerful or meaningful than actual content.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >