1

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

2 Answers 2

4
var check = '<%=Model.Check%>';
Sign up to request clarification or add additional context in comments.

Comments

1

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

2 Comments

caveat - the ":" is only mvc2?
Actually, I believe ":" is only mvc2 under .NET 4.0. We orignally had MVC2 under 3.5 and the notation was not supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.