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

  • Home
  • SEARCH
  • 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 5969511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:14:28+00:00 2026-05-22T20:14:28+00:00

I have a link as follows. @Html.ActionLink(Create Report, Screenreport, Reports, null, new { @class

  • 0

I have a link as follows.

@Html.ActionLink("Create Report", "Screenreport", "Reports", null, new { @class = "subNavA AddBorderTop", id = "screenReport", title = "Create Report" })

Once the link is clicked, I have a the following jQuery code which creates a JSON object and post the information.

$().ready(function () {

   // Create Report fron the screen data
   $("#screenReport").live("click", function (event) { GenerateScreenReport(this, event); });

}) /* end document.ready() */

function GenerateScreenReport(clikedtag, event) {

   var table = $(".EvrakTable").html();
   var screendata = tableParser(table);
   var Screentable = { Screenlist: screendata };

   var myurl = $(clikedtag).attr("href");
   var title = $(clikedtag).attr("title");


   $.ajax({ 
      url: myurl,
      type: 'POST',
      data: JSON.stringify(Screentable),
      dataType: 'json',
      contentType: 'application/json',
      success: function () { alert("Got it"); }
   }); 

};

To Handle JSON I have the following two classes. Realize two classes in the same namespace

namespace MyProject.ViewModels
{
   public class Screenrecord
   {
      public string Fname{ get; set; }
      public string LName { get; set; }
      public string Age { get; set; }
      public string DOB { get; set; }
   }


   public class Screentable
   {
      public List<Screenrecord> Screenlist { get; set; } 
   }
}

ANd in my controller, I have the following code:

   [HttpPost]
   public FileStreamResult Screenreport(Screentable screendata)
   {
      MemoryStream outputStream = new MemoryStream();
      MemoryStream workStream = new MemoryStream();
      Document document = new Document();
      PdfWriter.GetInstance(document, workStream);
      document.Open();
      document.Add(new Paragraph("Hello World"));
      document.Add(new Paragraph(DateTime.Now.ToString()));
      document.Close();

      byte[] byteInfo = workStream.ToArray();
      outputStream.Write(byteInfo, 0, byteInfo.Length);
      outputStream.Position = 0;

      return new FileStreamResult(outputStream, "application/pdf");

   }

This code is supposed to gerate PDF.
if I leave [HttpPost] as it is, it does NOT generate PDF and it goes to /Screenreport page, however I see my JSON is passed to the controller properly.
(screendata is populated properly – in controller)

But if I comment out [HttpPost], it DOES generate a PDF but screendata (in controller) is null.

Can someone please explain whats’s going on and help me figure it out. Thanksin 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-05-22T20:14:29+00:00Added an answer on May 22, 2026 at 8:14 pm

    I feel obligated to post my answer since I didn’t hear from anyone. I ended up creating a form that includes a hidden input, then saved my json object in the hidden input and then submit the form. This time I will get input as an string not a json or xml.

    var $hidInput = $("#dataToReport"); 
    $hidInput.val(JSON.stringify(Screentable)); 
    $('#frmScreenreport').submit(); 
    

    Thanks all anyways.

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

Sidebar

Related Questions

i have following HTML code:- <table class=results> <tr> <td> <a href=..>link</a><span>2nd Mar 2011</span><br>XYZ Consultancy
I have a link that I dynamically create which looks something like the following:
I'm gonna use DataPager as follows : I have a HTML Table : <table
i have a link on page 1 with querystring href=page2.html?selected=1 . What i want
I have the following HTML code: <div id=summary_form> <textarea class=summary>Please fill in</textarea><br/> <textarea class=summary>Please
Hello I have an HTML document as follows <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
Anyone have a link to what the C++ standard says regarding a compiler removing
I have a link in a pdf-document (PDF1), which is embedded in a browser
I've seen (and used) code to have a link spawn a javascript action many
Does anyone know, or have a link to an article or a step by

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.