tags:

views:

65

answers:

1

In my .aspx I've got the following javascript variable defined:

var action = <%=ProdView %>

In code-behind this returns a custom enum value:

protected ProductView ProdView { get; private set; }

I would figure that this would automatically be converted to a string in javascript? Looks like no because I get the runtime error "Item is not defined" where Item is the value ProdView.Item. Ultimately I want the action's value to be "Item" as the value.

Here's the Enum:

  public enum ProductView
  {
   Product,
   Item
  }
+5  A: 
jgauffin
Yep - what he said. Even mine didn't have the quotes - and mine would break too.
Robert Seder
I guess I don't understand under the hood how JS interprets this line of code in terms of shoving server-side references into a string.
CoffeeAddict