forum

Home / DeveloperSection / Forums / Inserting literal values along with razor into javascript

Inserting literal values along with razor into javascript

Anonymous User249908-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()", 
                 }

Updated on 08-Jul-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By