Home » DotNetNuke - Module Development » DotNetNuke Modules – DNN Controls – Label

DotNetNuke Modules – DNN Controls – Label

The DotNetNuke framework has several built-in controls that you should use instead of the controls you would typically use in an ASP.NET application. Before we can go much further, we need to review the controls that are available so that you know what is available prior to starting your development efforts. Not doing so would be like starting to develop in ASP.NET without learning what ASP.NET controls are available to you instead of the HTML controls you were used to using in ASP. Today’s post covers the most common of those controls, the DNN:Label control.


The DNN:Label control is probably the most frequently used control in DotNetNuke. This control is a plug-in replacement for the standard ASP:Label control you are use to using in ASP.NET. However, it embellishes the functionality in several respects.

  • It provides a help icon that will display a help message when the user clicks on the icon or if the mouse hovers over the icon.
  • The whole control is wrapped in a <label for=”…”> block to associate the label with an input element on the screen so that your application is automatically 508 enabled.
  • It provides a standard way of pushing all of your text strings into a resource file for internationalization purposes.

There are five properties that should be supplied to this control in your mark up:

ControlNameThis property specifies the ID of the control that the label is a label for. It’s the FOR attribute of the <label for=”…”> block.
ResourceKeyThis is an optional property that can specify the resource key to use for internationalization purposes. If this key is not provided, the ID property will be used followed by “.Text” to look for the string in the resource file. So, if the ID of the control is “Label1”, the key would be “Label1.Text”Of course, if you hard-wire the Text property, it won’t look for anything in the resource file.
HelpKeySimilar to Resource key, this is an optional parameter. If this key is not provided, the ID property will be used followed by “.Help”.
SuffixSuffix is another optional parameter that will allow you to add a string to all text that populates the Text property. You can use this to append a colon at the end of all of your labels.
TextThis is the default text. this is used if no localization text can be found. You may want to use this if you want to see what your screen is going to look like as you are designing it. I generally leave it blank.

You may be wondering about this whole “resource file” thing. I had a choice of covering resource files first, or introducing a control first. Both have their problems, but I think introducing a control first gives us some context for the “resource file” issue that we wouldn’t otherwise have if we had covered resource files first. So, hang on, we’ll get to resource files soon.

     

    Other post in DotNetNuke - Module Development

    Like this Article? Subscribe to get every article sent to your email.

    Related Post

    • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it […]
    • DotNetNuke Modules – Labels w/ no HelpDotNetNuke Modules – Labels w/ no Help While the bulk of the labels you use on a module will be DotNetNuke labels, occasionally you want to be able to put text on the screen that doesn't need context help and doesn't need to be […]
    • DotNetNuke Modules – LinkButtonsDotNetNuke Modules – LinkButtons As you can probably already guess, localizing a LinkButton in DotNetNuke is pretty straightforward. But you'll never guess what most people miss when they add this little control to their […]
    • DotNetNuke Modules – PortalModuleBaseDotNetNuke Modules – PortalModuleBase We've been through most of the basics now with respect to creating the View module of the DotNetNuke module set.  We will be moving on to the Settings module next.  But before we do, we […]
    • DotNetNuke Modules – Registering Your ModuleDotNetNuke Modules – Registering Your Module Yesterday, we used the DotNetNuke template to create a skeleton module and it's supporting files. Today, we want to get those modules registered into our Visual Studio copy of DotNetNuke […]

    About Dave Bush

    Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.