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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:59:27+00:00 2026-06-01T13:59:27+00:00

I am using C#.NET 2.0. I have already called functions that are stored in

  • 0

I am using C#.NET 2.0.
I have already called functions that are stored in external JavaScript file.However, the ,method currently used by me is like this
1) add the external JavaScript file reference
e.g.

2) call a local function on click event
onclick=”someFunction();”
This function(someFuction) is present within the design page

3) Then call the function in the external JavaScript file(say ABC()) from within this function.

This works, but there is the overhead of writing the someFunction each time.

Is there a way to call the function ABC() directly form button click ?

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-01T13:59:29+00:00Added an answer on June 1, 2026 at 1:59 pm

    Rohan, I guess you are talking about an ASP.NET web page with a JavaScript block in the header and another separate JavaScript file referenced from the page.

    If the external JavaScript file is referenced correctly, you CAN directly call the function.

    For example, say you have a JavaScript file named external.js referenced. And lets assume it has a function named ExternalFunction() in it. You can call the ExternalFunction() directly from you HTML or ASP.NET button like you usually call a function in the same file:

    Example:

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head runat="server">
        <script type="text/javascript" src="ExternalFile.js"></script>
    
        <script type="text/javascript">
            // Other local JavaScript code goes here
        </script>
    </head>
    <body>
        <form runat="server">
        <!-- ASP.NET button control -->
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ExternalFunction();" />
        <!-- HTML button -->
        <input type="button" onclick="ExternalFunction();" />
    </body>
    </html>
    

    Note that ASP.NET buttons use OnClientClick for JavaScript and HTML buttons use onclick

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

Sidebar

Related Questions

sending mail along with embedded image using asp.net I have already used following but
(using .Net 3.5) I have a routine that imports settings from an external datasource,
I have created a Data Access Layer using .NET. Everywhere that I update a
I'm using .NET 3.5 and I have a date that comes in as string
Here's my setup. I'm using .NET: I have a Main.aspx lets call it. That
using .NET 3.5. I have a function I want to make multithreaded calls to.
So I have a textbox in C# (Using .NET forms) where I am going
I have previously written user interfaces using .NET and Windows Forms. I'm about to
I am using vb.net language I have a dropdownlist, which is filled by below
I have two byte arrays in C# using .NET 3.0. What is the most

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.