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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:01:47+00:00 2026-05-20T18:01:47+00:00

a have two aspx pages page1.aspx and page2.aspx . i have an href in

  • 0

a have two aspx pages page1.aspx and page2.aspx.
i have an href in page1.aspx <a id="GoHref" href="page2.aspx">
i want that when users click docHref to be redirected to page2.aspx and download a doc file via an automatic click on <a id="DocHref" runat="server">

page2.load is as below:

       protected void Page_Load(object sender, EventArgs e)
    {

       if(!IsPostBack)
            DocHref.HRef="./mydoc.doc";
    } 

i ‘d like to do do an automatic click on document.ready, something like this:

     $(document).ready(function() {

         $('#DocHref').trigger('click');

    });

But it doesn’t work !!
is this a good way to download a doc file ? Or there a better server side way?

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-05-20T18:01:48+00:00Added an answer on May 20, 2026 at 6:01 pm

    You’re better off using the window .location property than simulating clicks as there is far less overhead.

    <a id="myLink" href="somewebsite.com">My Link</a>
    
    $(function() {
       window.location.href = $("#myLink").attr("href");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two pages page1.aspx and page2.aspx, both have code behind with partial classes.
I have two pages that inherit from one master page, First.aspx or second.aspx. Navigation
I have two ASP.NET pages: site.com/foo/bar.aspx that should be world accessible and site.com/foo/baz.aspx that
Coding Platform ASP.NET 4.0 WebForms I have two pages that are relevant here Login.aspx
Let's say I have two pages on the same ASP.NET C# WebSite. Page1.aspx does
I have two aspx pages: DashboardPreview.aspx: This is the homepage. It shows top 5
I have two pages, test1.aspx and test2.aspx test1.aspx has this protected void Page_Load(object sender,
I have two pages, NonMember.aspx and Member.aspx. If a user comes to the site,
I have a C#/ASP.NET .aspx page that declares two controls that each represents the
I have two pages: Default.aspx and Target.aspx. On Default.aspx are two buttons: Button1 redirects

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.