Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6804977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:31:54+00:00 2026-05-26T19:31:54+00:00

Friends, I am trying to use DyGraph in my application. Please look at the

  • 0

Friends,

I am trying to use DyGraph in my application. Please look at the code below –

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
    <title>crosshairs</title>

    <script type="text/javascript" src="dygraph-combined.js"></script>

    <script type="text/javascript" src="data.js"></script>
  </head>

The code uses data.js file containing function to get some static data.
I want data.js to be generated using a controller method so that it will generate data using database.

Can anybody help me out to resolve this issue.

Thanks for sharing your valuable time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:31:54+00:00Added an answer on May 26, 2026 at 7:31 pm

    You could define a controller action:

    public ActionResult Data()
    {
        // Obviously this will be dynamically generated
        var data = "alert('Hello World');";
        return JavaScript(data);
    }
    

    and then:

    <script type="text/javascript" src="<%= Url.Action("Data", "SomeController") %>"></script>
    

    If you have some complex script that you don’t want to generate in the controller you could follow the standard MVC pattern by defining a view model:

    public class MyViewModel
    {
        ... put required properties
    }
    

    a controller action which would populate this view model and pass it to the view:

    public ActionResult Data()
    {
        MyViewModel model = ...
        Response.ContentType = "application/javascript";
        return PartialView(model);
    }
    

    and finally a view which in this case will be the javascript representation of the view model (~/Views/SomeController/Data.ascx):

    <%@ Control 
        Language="C#" 
        Inherits="System.Web.Mvc.ViewUserControl<MyViewModel>" %>
    alert(<%= new JavaScriptSerializer().Serialize(Model.Name) %>);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the FB.ui() to send apprequests to friends. My application
I'm trying to understanding backbone code. I read this http://addyosmani.com/blog/building-spas-jquerys-best-friends/ then I plan to
I am trying to send mail to my friends through my Java Mail application.
I'm trying to use code similar to clrdump to create mini dumps in my
I'm trying to sort friends by 2 criterias those who use my app first
Hi trying to use the stream table to access a friends news feed SELECT
I am trying to use graph batch api , is there any reference code
Friends i am trying to develope a desktop application it's requirement is 1.It should
In my application I'm trying out to list only the friends who are all
I'm trying to figure out the best HTTP headers to send for four use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.