Asp.net mvc html melper -


I have found this function as an html helper, which should write the javascript function on the page, The page will call it & lt;% HTML.RenderBaseUrlScript (); %>

My problem is that the script is never written on the page, I search in the source and can not see it anywhere, I have to take it from head to body of html Have tried the main page, I am really confused as to why it is not working, please help public static string RenderBaseUrlScript (this HtmlHelper helper) {

  return string. Format ("& lt; script type = 'text / javascript' & gt; $ .url = function (URL) {{ Do not '{0}' + url;}} ", GetBaseUri ()); }  

Try:

  & lt; % = Html.RenderBaseUrlScript ()%>  

Note = Icon and no semicolons. Since your HTML helpful method is not written directly to the response stream (which is good), you must actually call response.write () on the output of your function. & lt;% =%> Tags Response Deed () .

If your helpful method was directly writing for the response to stream yourself, your code will work but it is better in this way.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -