0

How to use Registerstartupscript in my project ? Is it any soluction for that ?

3 Answers 3

3

In ASP.NET MVC, you have full control over the markup being produced. If you need a script to be included on the page, simply do it using vanilla HTML/JavaScript.

There really should be no need for RegisterStartupScript in ASP.NET MVC.

Sign up to request clarification or add additional context in comments.

Comments

0

inHTML Code :

<%@ Import Namespace="MvcTest.HelperExtension" %>
<script src="<%= Url.jQueryUI("jquery.ui.accordion.min.js")%>" type="text/javascript"></script>

. . . .

in Code :

public static class UrlHelperExtension
{  

    public static string jQuery(this UrlHelper helper, string fileName)
    {
        return helper.Content(string.Format("~/Content/Scripts/{0}", fileName));
    } 

}

1 Comment

0

Take a look here http://www.codeproject.com/Articles/38936/Using-WebControls-In-ASP-NET-MVC-Views-Part-3.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.