title: Is there any way to use jquery code inside razor?
body: <p>Here is my jQuery code with Razor:</p>
  
  <pre><code>    $("#GroupC_grup_name").attr('value', '@foreach (SelectListItem sel in (SelectList)ViewData["Gruplar"]){ @sel.Text }')
      $("#GroupC_id").attr('value', '@foreach(SelectListItem sel in (SelectList)ViewData["Gruplar"]){ @sel.Value }')
  </code></pre>
  
  <p>I want to merge these together, as in I dont want to call for <code>ViewData["Gruplar"]</code> twice.</p>
  
  <p>Can I do something like this?</p>
  
  <pre><code> @foreach(SelectListItem sel in (SelectList)ViewData["Gruplar"]){
       @:$("#GroupC_grup_name").attr('value', '@sel.Text');
       @:$("#GroupC_id").attr('value', '@sel.Value');
   }
  </code></pre>
  
  <p>I've tried everything I can think of but still can't achieve what I want.</p>