Why must placeholders be lowercase? - asp.net

I've been curious about this for a while so I thought I would ask it here on stack. I was told to always lowercase my Sitecore placeholders by a consultant helping out on one of my projects.
I was new to Sitecore at the time, so I took it in stride and never really questioned it. However, as I've become more familiar with the system and how extensible and modular it can be, I really can't imagine why this would be a requirement..?
There doesn't appear to be any documentation on the subject, however, Sitecore themselves seem lowercase their placeholders in every example site I've ever seen.
The topic is metioned a few times on the web including right here on stack, however, the question remains: WHY?

You may be referring to a specific version of Sitecore that had a bug in it. There is currently no requirement for using only lowercase. I suspect when Sitecore's dependency injection / layout engine runs, is compares the placeholder keys on the layout to the controls bound and ignores the cases when matching up placeholder keys.

I isn't a requirement that I've ever heard about and on multiple projects I've had placeholders that aren't all lower case, typically I use camel casing for those.

Related

Semantic web support for asp.net

I'm doing a project and asp.net is one of my possible choices (the other one being php). I need to implement some semantic functionality to improve searches.
I know some php frameworks support semantics but i want to know if asp.net has any[The most used] tool (3rd party or built in) that will also support this.
I've been reading more about this subject and i think what i'm really looking for is tools in order to deliver more accurate results to user searches by not only matching word but its meanings.
I'm sorry if the semantic web term caused confusion but my guide teacher called it like that
You should look into dotNetRDF and ARC PHP.
Other good resources
Executive’s Quick Start Guide to Web 3.0 and the Semantic Web
RDF Primer
Wikipedia: Semantic Web
RDFa Primer
That last one is about the recommended way to markup HTML with semantic meaning. Improving your search results to include meaning can be done a number of ways and may or may not include using the semantic web technology stack per se. Perhaps you only mean adding tags to blogs, or faceted searching such as that provided by SOLR. You may need to clarify what kind of searching you want to do.
As others have said you need to clarify what you want to do, while you have clarified your question a little it is still not clear whether you actually need a full Semantic Web technology stack.
Your project may be completely doable without any Semantic Web tech just using standard text indexing systems like Lucene and SOLR. I'm fairly sure both of these are available in .Net, I'm not a PHP developer myself so not sure if there are usable PHP equivalents.
If you need a full Semantic Web technology stack then either of the options harschware has suggested are good (disclaimer - I develop dotNetRDF). Whether they actually do what you need them to do depends on what parts of the Semantic Web technology stack you need. Both have good RDF and SPARQL support but minimal OWL support.
"Semantic Web" just means using the appropriate html tags for their defined (semantic) purpose. This is accomplished by not ignoring less-used tags (label, legend, fieldset, cite, etc), using table only for tabular data, and especially not using div or span when more-specific tags are really a better fit... things like that.
With this in mind, of course asp.net supports a semantic web. You can put any html you want into asp.net pages. MVC makes this easier, but you can do it with webforms, too.
With that constraint out of the way, my standard advice when beginning a new project is to start with what you know. If you already know php or asp.net, stick with that. It will allow you to be a lot more productive, more responsive to issues, and make fewer mistakes than you will if you're learning a new platform from scratch.

ASP.NET: Why Localize strings?

I'm just getting started using Resharper with VS-2008, and one of the 'errors' it gave me was to localize a Label's text in the code-behind. I've worked with Localization before to Localize a website from english into french, but I don't understand what the benefit is to localizing beside that usage.
If it's an internal application that you're not going to be distributing, there's not much of a benefit to it. It may be handy to collect all your strings in one central location for easy maintenance later, but only you know whether that's worth the effort on your specific project.
That's a bit like asking what the benefit of addition is beyond adding two numbers together.
Localization is generally about presenting the most relevant user experience to each user with minimal code changes - giving each user a "skin" using their language and regional settings (e.g. for things like formatting numbers appropriately).
Granted very many web sites aren't localized at all, but R# is prompting you do give your users the best possible experience :)

How do you find the balance between Javascript (jQuery) and code behind in ASP.NET

Stackoverflow members,
How do you currently find the balance between javascript and code behind. I have recently come across some extremely bad (in my eyes) legacy code that lends itself to chaos (someHugeJavafile.js) which contains a lot of the logic used in many of the pages.
Let's say for example that you have a Form that you need to complete.
1. Personal Details
2. Address Information
3. Little bit more about yourself
You don't want to overload the person with all the fields at once, so you decide to split it up into steps.
Do you create separate pages for Personal Details, Address Information and a Little bit more about yourself.
Do you create controls for each and hide and show them on a postback or using some update panel?
Do you use jQuery and do some checking to ensure that the person has completed the required fields for the step and show the new "section" by using .show()?
How do you usually find the balance?
First of all, let's step back on this for a moment:
Is there a CMS behind the site that should be considered when creating this form? Many sites will use some system for managing content and this shouldn't be forgotten or ignored at first glance to my mind.
Is there a reason for having 3 separate parts to the form? I may set up a Wizard control to go through each step but this is presuming that the same outline would work and that the trade-offs in using this are OK. If not, controls would be the next logical size as I don't think a complete page is worth adopting here.
While Javscript validation is a good idea, there may be some browsers with JavaScript disabled that should be considered here. Should this be supported? Warned about the form needing Javascript to be supported?
Balance is in the eye of the beholder, and every project is different.
Consider outlining general themes for your project. For example: "We're going to do all form validation client-side." or "We're going to have a 0 refresh policy, meaning all forms will submit via AJAX." etc.
Having themes helps answers questions like the one you posted and keeps future developers looking in the right places for the right code.
When in doubt, try to see your code through the eyes of someone who has never seen it before (or as is often the case, yourself 2 to 3 years down the road), and ask yourself: "Based on the rest of the code, where would i look for this function?"
Personally, I like option number 3, but that's just because it fits best with the project I'm currently working on and I have no need to postback or create additional pages.

ASP.NET UI Customization

In my application, I have a situation wherein the users will need to have the flexibility to customize the UI to a certain extent. The following are some of the customizations that is being discussed now...
Change Label text associated with the with Use Input controls
Mark a control as Mandatory/Read only/Hidden
Assign a regular expression for the text box
Are there any recommended design patterns for my situation? Seems like I need to store all these in a database and worried about the performance impact if I have to read every element from the database for every page.
Thanks,
Harsha
I would look at some of the open-source CMS or portal systems written in ASP.NET and see how they are doing UI customization (if they are).
Phil Haack has some insight at the following article:
Scripting ASP.NET MVC Views Stored In The Database
http://haacked.com/archive/2009/04/22/scripted-db-views.aspx
Apparently it's not an easy thing to do in ASP.NET. It's easier to do in ASP.NET MVC, because the markup is cleaner and you can control it with jQuery.
The overall concept you are going for is not easy to have system wide, however the specifics you stated are fairly easy.
You'd have to setup some fields in a database for those values and then on the page load set those values on the page load. Pretty trivial from a 'how to'. Which your question shows that you 'get'.
Now unless you are using an Access Database :-), I don't think you have to worry about the performance hit. But if truly concerned, put some caching logic on those values so you only have to hit the database once. Though, be aware this will store the values in memory on the server, so if you are working with a very minimal hardware this could be an issue as well.

ASP.NET MVC - Passing redundant arguments to actions

This question may seem a little bit stackoverflow-implementation specific, but I have seen a similar pattern on other websites that are using REST-friendly URL rewriting as well.
For example, a link to a particular question looks like this:
ASP.NET MVC - Passing redundant arguments to actions
1388703 apparently being some kind of unique ID and the rest being the Title of the question.
The ID itself should be enough, so what may be the advantage of putting the question title (in this particular case, one can see that stackoverflow uses this almost everywhere, e.g. for badges, user profiles etc.) as second parameter?
When you remove the last part of the URL, the same page is displayed, which is expected. But when you change the last part to any other string, the same result is still displayed.
Is this only a cosmetic issue, allowing easier management of links (e.g. when storing bookmarks?) or does it have any other advantages?
It's for search engine optimization.
The link ASP.NET MVC - Passing redundant arguments to actions doesn't mean much to a search engine but ASP.NET MVC - Passing redundant arguments to actions allows a search engine to match the words "asp net mvc" etc which they will normally give more weight to as it's in the URL.
It's also more user friendly as it gives more meaning to the content of the page form the URL.
It is cosmetic and it's also better search engine optimization to keep easily readable names in the url as that will make the search engines find it easier.
The biggest advantage that the extra text has is for SEO. The extra text in the link gives google a lot more help understanding what's in the page.
I'd also mention that if a title is changed (i.e. for spelling, etc), the ID number still works.

Resources