i just want to be able to call a javascritp subroutine on the client, after the server has done its thing (when an action completes or control goes to the view, i'd dont mind calling the js from the view either).
for some reason, even vs2010 doesn't let me put breakpoints in <% ... %> tagged areas between <script...> and </script>
tagged areas. i for this reason can't figure out whats going on and how it's running things. here is what i've put in my view, and the javascritp should run, but it doesn't....
im just trying to call "RunOnceRoutines;" but it's not getting called!
the 2 questions: how on earth do we call javascript methods from server, and where is all this lovely javascript debugging i've heard about since vs2008? no where to be found!
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of FP.RatePicModel)" %>
<script type="text/javascript" language="javascript">
var RatePicPanelRunCount = 0;
function ChangeMainPic(newSrc) {
$get("imgPic").src = newSrc;
alert($get("imgPic").src + '\n' + newSrc);
RatePicPanelRunCount++;
}
function UpdateGlobalVariables() {
// Update variables...
ShownPicID = <%=Model.CurShownPicID%>;
<% //this shows up!
msgbox(model.curshownpicid)
%>
ShownUserID = <%= Model.CurShownUserID %>;
CurrentUserID = <%= UserID %>;
alert('CurUserID is ' + CurrentUserID);
alert('From cookie its ' + getCookie('UserID'));
}
function RunOnceRoutines() {
if (RatePicPanelRunCount == 0) {
ChangeMainPic('<%= Model.CurPicURL%>');
UpdateGlobalVariables;
};
}
RunOnceRoutines;
</script>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<%
Html.RenderPartial("AddToFavs", Model.AddFavAction)
%>
</td>
</tr>
</table>