views:

31

answers:

2

can I do something like this to get the Mode.check value in my view..

<script type="text/javascript">
var check = <%(Model.Check); %>;
    $(document).ready(function () {
      if(check == "Save")
      {
        $("#ObnRemove").show();
         $("#ObnAdd").val('Save');
      }
      else
      {
          $("#ObnRemove").hide();
      }
        $("#TextEdit").click(function () {
            $("#ObnRemove").show();
        });
    });
</script>

but i am not getting Model.check value?

what I am doign wrong here?

thanks

+3  A: 
var check = '<%=Model.Check%>';
John Sheehan
+1  A: 

You can just use <%: Model.Check %>

Simon Hazelton
arrrrse 7 second beat !
Simon Hazelton
caveat - the ":" is only mvc2?
David Archer
Actually, I believe ":" is only mvc2 under .NET 4.0. We orignally had MVC2 under 3.5 and the notation was not supported.
Robaticus
':' notation is .NET 4.0 only and will not work on 3.5.
Praveen