Users Pricing

forum

Home Forums Inserting literal values along with razor into javascript – MindStick

Inserting literal values along with razor into javascript

Anonymous User 2864 08 Jul 2013
Hi Expert!

I'm trying to insert quotes AND a value inside a javascript function. I'm doing this through a foreach method call.

@foreach (DateEarningsViewClass d in Model.dateEarnings) {
                 @d.date.ToShortDateString()
             }

The issue is that I want to insert around each date, but I get all sorts of errors when I attempt doing so. How can I do this?

What I essentially wanna display is:

@foreach (DateEarningsViewClass d in Model.dateEarnings) {
                     "@d.date.ToShortDateString()", 
                 }

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md