Question

Say I have a control that is used on 10 different pages, and this control has a help icon. Each page should display it's own help text -which is about a paragraph each. Which help text to show is selected by a JavaScript function.

I realize in my case 10 paragraphs will not be a significant performance hit; however for the sake of knowledge, what would be the best implementation? Save the text in a server control -such as a HiddenField- or straight in the JavaScript?

Was it helpful?

Solution

If I had to create a DB-less solution, I would do one of three things:

Option 1

Store the text in an XML file that can be read by your web application.

<?xml version="1.0" encoding="utf-8" ?>
<HelpTexts>
  <HelpText name="HelpText1">
    Some help text
  </HelpText>
  ...
</HelpTexts>

Option 2

Store the text in the web.config.

<add key="HelpText1" value="[Some help text" />

var foo = WebConfigurationManager.AppSettings["HelpText1"];

Option 3

Store the text in the template that's using the control and set it as a property. This is my preference because it's relatively clean and allows the control to be used on another page quickly and easily.

protected void Page_Load(object sender, EventArgs e)
{
    myControl.HelpText = "[Some help text]";
}

OTHER TIPS

You can do this -

Create a 10 Help pages and on the click of Help button when the java script loads, you can show the specific help page in Iframe.

Like James said, I would recommend using XML Files. In particular, using the Resources that are made available by ASP.net.

They are simple to use, and are just what you need!

You can read more about the HERE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top