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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:04:44+00:00 2026-05-27T12:04:44+00:00

I have a requirment to invoke a controller method from the view page. On

  • 0

I have a requirment to invoke a controller method from the view page. On click of the link below the method should be invoked.

@Html.ActionLink(item.InvoiceNumber, "SendPdfStatement", "Invoice", 
                 new { item.InvoiceNumber }, new { target = "_blank" })

the method signature is as:

public void SendPdfStatement(string InvoiceNumber)
    {

        InvoiceNumber = InvoiceNumber.Trim();

        ObjectParameter[] parameters = new ObjectParameter[1];
        parameters[0] = new ObjectParameter("InvoiceNumber", InvoiceNumber);

        List<Models.Statement> list = new List<Models.Statement>();
        list = _db.ExecuteFunction<Models.Statement>("uspInvoiceStatement", parameters).ToList<Models.Statement>();

        var statementResult = _db.ExecuteFunction<Models.Statement>("uspInvoiceStatement", parameters);
        Models.Statement statement = statementResult.SingleOrDefault();

        pdfStatementController.WriteInTemplate(statement);                                 

   }

now the problem is when i click on the link, a blank window opens. I know it is something with new { target = "_blank" }. If i pass null in its place my page with link becomes blank. What shall i pass here so the my page remains as it is and no new blank window also appears.

  • 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-27T12:04:45+00:00Added an answer on May 27, 2026 at 12:04 pm

    Change your controller Action. The page that you get is blank because you are not returning anything. Do

     public ActionResult SendPdfStatement(string InvoiceNumber)
    
        {
        InvoiceNumber = InvoiceNumber.Trim();
    
            ObjectParameter[] parameters = new ObjectParameter[1];
            parameters[0] = new ObjectParameter("InvoiceNumber", InvoiceNumber);
    
            List<Models.Statement> list = new List<Models.Statement>();
            list = _db.ExecuteFunction<Models.Statement>("uspInvoiceStatement", parameters).ToList<Models.Statement>();
    
            var statementResult = _db.ExecuteFunction<Models.Statement>("uspInvoiceStatement", parameters);
            Models.Statement statement = statementResult.SingleOrDefault();
    
            pdfStatementController.WriteInTemplate(statement); 
    
        return View();
        }
    

    EDIT:
    Or you should use AJAX so that your page is not reloaded and you don’t have to return anything from your method. Read here http://www.asp.net/mvc/overview/older-versions-1/contact-manager/iteration-7-add-ajax-functionality-cs.

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

Sidebar

Related Questions

We have a requirment which requires to have an Handler that is extended from
I am using jquery ajax method on my aspx page,which will invoke the webmethod
I have a requirment, of invoking a Java file from Oracle database. In my
I have the following form in my /app/views/password_resets/new.html.erb view <% form_tag password_resets_path do %>
In our project we have requirement that, after receiving sms message from third party
I have a requirement that should assign a counter variable for each thread that
I have a iPhone app which uses TabBar in Navigation controller. I have a
I have the following Query and i need the query to fetch data from
In Linux When I invoke python from the shell it replicates its environment, and
I have a view containing a number of UIButtons Tom and Jerry, The Lion

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.