I have an ASP.NET Web App with the back end written in C#. In the C# code I have a constant as follows:
const string MAX_NAME_LENGTH = "20";
I then a have user control named TextInput with an attribute named maxLength. I would like to use it in HTML as follows:
<MyTagPrefix:TextInputFL maxLength = "MAX_NAME_LENGTH " runat="server"/>
Please note that I would like to use the C# constant's name ("MAX_NAME_LENGTH") in the HTML and somehow convert "MAX_NAME_LENGTH" into the assigned value ("20") in the maxLength property set clause:
public string maxLength
{
set
{
// Code to convert the provide string value of the C# constant's
// name (in this case "MAX_NAME_LENGTH") into the constant's
// value ("20").
}
}
Does anyone have any ideas on how to convert the the C# constant's name into is value?