0

I have declared a variable lenght in my javascript tag and now i want to use that 'length' variable in html table tag how to use that in razor engine. i have tried

<table>
<tr>
@for(var i=0;i<@lenght;i++)//this is not working

  {some code}
  </tr>
  </table>

any suggestions?

2
  • length or lenght? The correct spelling is length. Commented May 13, 2014 at 9:45
  • You will probably find your solution here Commented May 13, 2014 at 9:45

1 Answer 1

0

If the length variable is defined in javascript, it only "lives" in the browser.

Razor code is executed on the server, so you cannot access this variable.

You could try to build the table in the browser using javascript.

Sign up to request clarification or add additional context in comments.

Comments

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.