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 7982157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:35:39+00:00 2026-06-04T10:35:39+00:00

I am working on asp mvc application. I am generating charts depending upon data

  • 0

I am working on asp mvc application.
I am generating charts depending upon data from data base.
When i click on go button i have call getReportData() function that fetches result from db and set chart images.

When i call first time my function works fine but for secound time only grid data is displayed, i mean function that generate image is not call for second time, I have tried to debug it but only first time i am getting debugging point not second time.

  function getReportData() {
        //            debugger;
       //Enable wait Icon & disable others


       $('#span_bar_bg').css('display','none');
       $('#span_bar_wait').css('display','block');
       $('#span_bar_result').css('display','none');
       $('#span_pie_bg').css('display','none');
       $('#span_pie_wait').css('display','block');
       $('#span_pie_result').css('display','none');
       var report='ProductNameBatch';
       var subreport='Non-FaceBook';
        if( report.toLowerCase()=='ctss' )
        {
         alert('Report is temporarily Un-available');
         return;
        }

        if (parent.top.$("input#from_date").val() == "" ||  parent.top.$("input#to_date").val() == "") {
            alert("Invalid Date Range !!!");
            return;
        }


        $("#span_grid_bg").css('display','none');
        $("#span_grid_view").css('display', 'block');



           // "sScrollX": "100%",
           // "sScrollXInner": "101%",
           // "bScrollCollapse": true,


        $('#grid_view').dataTable({
            "bAutoWidth": true,
            "bServerSide": false,
            "sAjaxSource": "fetchGridReport?&from_date=" + parent.top.$("input#from_date").val() + "&to_date=" + parent.top.$("input#to_date").val() + "&report="+report+"&subreport="+subreport,
            "bProcessing": true,
            "bRetrieve": false,
            "bDestroy": true,
            "iDisplayLength": 17,
            "aoColumns": columnList
        });


         $('#grid_view').dataTable().fnAdjustColumnSizing();

        //Request for reports 

         debugger;
           $('#span_bar_result img[alt="Report by Country-Language"]').attr('src','/fetchChartReport?chartType=Bar&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' +parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Country-Language&displayformat=2&filterParamList=no');
           $('#span_pie_result img[alt="Report by Country-Language"]').attr('src','/fetchChartReport?chartType=Pie&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' + parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Country-Language&displayformat=2&filterParamList=no');

         debugger;
           $('#span_bar_result img[alt="Report by Response"]').attr('src','/fetchChartReport?chartType=Bar&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' +parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Response&displayformat=2&filterParamList=no');
           $('#span_pie_result img[alt="Report by Response"]').attr('src','/fetchChartReport?chartType=Pie&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' + parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Response&displayformat=2&filterParamList=no');

         debugger;
           $('#span_bar_result img[alt="Report by Resolved vs UnResolved"]').attr('src','/fetchChartReport?chartType=Bar&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' +parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Resolved vs UnResolved&displayformat=2&filterParamList=no');
           $('#span_pie_result img[alt="Report by Resolved vs UnResolved"]').attr('src','/fetchChartReport?chartType=Pie&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' + parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Report by Resolved vs UnResolved&displayformat=2&filterParamList=no');

         debugger;
           $('#span_bar_result img[alt="Turk Spend by Country($)"]').attr('src','/fetchChartReport?chartType=Bar&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' +parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Turk Spend by Country($)&displayformat=2&filterParamList=no');
           $('#span_pie_result img[alt="Turk Spend by Country($)"]').attr('src','/fetchChartReport?chartType=Pie&from_date=' + parent.top.$("input#from_date").val() + '&to_date=' + parent.top.$("input#to_date").val() +  '&report='+report+'&subreport='+subreport+'&reporttitle=Turk Spend by Country($)&displayformat=2&filterParamList=no');



        //register call back functionality invoked when result image response complete
         $('img[id^="img_barchart_result"]').bind('load',function(){
             onLoadComplete('bar');

         });

         $('img[id^="img_piechart_result"]').bind('load',function(){
              onLoadComplete('pie');
         });

    }

Here is my Control Function

 public FileResult fetchChartReport(SeriesChartType chartType, string from_date, string to_date, string report, string subreport,string reporttitle,string displayformat, string filterParamList)
    {
        try
        {
            Chart chart = new Chart();
            string repportlistid = "chart-" + report.ToLower() + "-" + subreport.ToLower();
            //List<string> reportNameList=  GetParameterListById(repportlistid); 
            //return View();

            reportObject = getReportInstance(report);
            chart = reportObject.getChartReport(chartType, from_date, to_date, report.ToLower(), subreport.ToLower(), reporttitle,displayformat, filterParamList);

            MemoryStream ms = new MemoryStream();
            chart.SaveImage(ms);


            return File(ms.GetBuffer(), @"image/png");

        }
        catch (Exception ex)
        {
            return File(Server.MapPath(Url.Content("~/Content/dashboard/images/dash_no_data.jpg")), "image/jpg");
        }



    }

Thanks in advance

  • 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-06-04T10:35:40+00:00Added an answer on June 4, 2026 at 10:35 am

    Paven,

    This is due to the DOM changing when you initiate the img click, therefore your bind eventhandler gets blown away. Try using the jquery .on() event handler instead:

    http://api.jquery.com/on/

    this works in similar ways to the old jquery .live() event in that the event handlers are retained even when the DOM is refreshed until you issue an .off() request, or navigate away from the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an asp.net MVC 3 application which is using Data Models from
I am working with an ASP.NET MVC application. I have one master page having
I am working on an asp.net MVC 3 application. I have a C# function
I am working on asp.net MVC 3 application. I have created a Razor view
I am working in an ASP.NET MVC Application. I have a view model as
I am working on a ASP.NET MVC application where we have to write our
I am working on a asp.net mvc application. I have a situation where I
I'm working on an asp.net-mvc application. The linq data context is being passed into
I am working on an ASP.NET MVC application and using jQuery. I understand from
I'm working on an asp.net MVC application. I have a class that wraps a

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.