All about the ultimate complexity of your project ... if it is a 2-page project, there is nothing wrong with hard-coded so far only once and it is in an accessible place that will be changed not only by you, but also by those who will take this project in the future.
for example, in the helper class add
public const string[] SearchTypes = new string[] { "polymeric", "cord", "seat" };
add an extension method to help you
public static string ToJavaScriptArray(this string[] array) { string r = ""; foreach(string s in array) r += String.Format("'{0}',", s); return r.TrimEnd(','); }
and then, in your javascript on that particular page you want, you can easily add
var searchTypes = new Array(<%= SearchTypes.ToJavaScriptArray() %>);
and use the javascript array in your code to check if the type is in it, for example
add prototype to help us
Array.prototype.has = function(obj) { return this.indexOf(obj) >= 0; }
then
if( searchTypes.has( document.getElementById('textBox1').value ) {
hope this helps.
source share