title: How to pass a model field to a Javascript function in a view?
body: <p>I have a simple question that has been vexing me tonight...  I have an ASP.NET MVC4 + Razor application.  When the user clicks a radio button, I want to pass a string value from a field in the model, "Timezone",  to the onclick handler, which is a javascript function.  In the javascript function, I will take the string and do some work, but for now, I simply pop-up an alert().  I have found a lot of references to having to do special quoting, and I've tried all of them, but no matter what I do, the alert shows nothing, but the form that has the radio button shows me a valid value in its Timezone textbox.  </p>
  
  <p>I would really appreciate your help to figure out what I am doing wrong...  If this is not possible (why?), then can I access the model's value from the javascript function?  I tried @model.Timezone, but always have an empty string.  Really vexing stuff when I know that it must be something really easy!   Anyway, here is the code for the radio button and the simple javascript function.  I'd really appreciate your help!</p>
  
  <p>Thanks,
  Mike</p>
  
  <pre><code>    @Html.RadioButtonFor(model =&gt; model.TimezoneSource, "C",
          new {propertyName = "UpdateTimezoneRadioButton", 
              onClick = "TimezoneClicked(@model.Timezone)" })Update Timezone
  
  function TimezoneClicked(timezone) {
      alert(timezone);
  }
  </code></pre>