tags:

views:

85

answers:

1

Greetings, how can I inject c# code (my Model property) inside javascript? I want to do something like this:

$(".star<%=Model.ROWGUID %>").mouseover(function() {
    var span = $(this).parent("span");
    var newRating = $(this).attr("value");
    setRating(span, newRating);
});

This works fine for single view. But when I Render PartialView in loops it causes the problem. Even alert("test") in mouseover event is not executed

EDIT Ok, I figured out where the problem was. This was missing:

 $(document).ready(function() {
+3  A: 

This will work fine, but only in an ASPX file.

SLaks
I recommend to do it on Render
Ion Todirel