Feedback

  • Contents
 

Text Gadget

Text gadgets display a message to the logged on user. You can create the message using text, code, data from a data source, or any combination of these methods. You can format the message using HTML tags.

Examples

The following examples show what to type in the Text box when configuring the Text gadget to display a message to the user.

Text only

The following example shows how to display a text-only message.

Welcome to Dashboard

The resulting message that displays to the user is, "Welcome to Dashboard."

You can use an HTML tag to format the message. The following example applies the bold style to "Dashboard."

Welcome to <b>Dashboard<\b>

The resulting message to the user is, "Welcome to Dashboard."

Text and code

The following example shows how to use text and code to display a message.

<div style="font-size:24px;margin-top:5px;text-align:left">@{

  var timeofday = "morning";

  var hour = DateTime.Now.Hour;

  if(hour < 12) timeofday = "morning";

 else if (hour < 17)

    timeofday = "afternoon";

  else

    timeofday = "evening";

}

Good <i>@timeofday</i>, @User.Identity.Name</div>

The resulting message that displays to the user is, "Good afternoon, Joe Smith." The message breaks down as follows:

"Good" is specific text you typed.

"afternoon" is based on the time of day and has the italic style applied.

"Joe Smith" is based on the logged on user's ID.

Text and data from a data source

The following example shows how to use text and a data source to display a message. This example is for a data source that returns one row of values that includes the user name, last payment amount, and last payment date and time.

$(Name), your last payment to post was for $(PaymentAmount) dollars on $(LastPaymentDateTime).

The resulting message that displays to the user is, "Joe Smith, your last payment to post was for 500 dollars on 2/7/2014 3:00 PM." The message breaks down as follows:

"Joe Smith" is the user ID from the data source.

", your last payment to post was for " is specific text you typed.

"500" is the payment amount from the data source.

" dollars on " is specific text you typed.

"2/7/2014 3:00 PM" is the payment date and time from the data source.

As with the other methods for creating a message, you can use HTML tags to format the message. For example, to apply the bold style to the payment amount, type the following:

<b>$(PaymentAmount)<\b>

Ensure that you insert punctuation and spaces in the appropriate places so that the text doesn't run together.

Related Topics

Add a Text Gadget to a Dashboard

Configure a Text Gadget

Modify a Text Gadget

Data Sources