I have a view file(.cshtml) with this C# block in top of file:
@{
List<string> selectedCategories = new List<string>();
}
well I want to use the selectedCategories list in the following javascript block
@section scripts{
<script src="../../Scripts/jquery-1.6.4-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#list-all-categories").selectable({
stop: function () {
var result = $("#selectedCategories").empty();
@selectedCategories.Clear()
$(".ui-selected", this).each(function () {
var Mytext = $(this).text();
@selectedCategories.Add(Mytext.toString());
});
}
});
});
</script>
}
SO, it's does not work!... at all!!!
I have some errors like this: -Conditional compilation is turned off -The name 'Mytext' does not exist in the current context -...
what should I do?! help me please!