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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:47:42+00:00 2026-05-13T07:47:42+00:00

calling a js function using onclick… onclick=SubmitAge(66, ‘ctl00_MainContent_arTo_upAgeRange’) function just calls an updatePanel from

  • 0

calling a js function using onclick…

onclick="SubmitAge(66, 'ctl00_MainContent_arTo_upAgeRange')" 

function just calls an updatePanel from the client… but its saying object expected at the onclick= part!!!

here is the function, is there anything wrong with the code?

function SubmitAge(age, UpdatePanelID) {
    $get('HiddenAge').value = age;
    __doPostBack(UpdatePanelID);
}

EDIT: THE SUBMITAGE FUNCTION IS INSIDE A .JS FILE (AGERANGE.JS) AND ONLY WHEN MOVED HERE DOES IT STOP WORKING: HERE IS THE LINKING METHOD/HEADERS FROM THE ASCX USERCONTROL INWHICH IT IS ALL CONTAINED…

%@ Control Language=”VB” ClassName=”AgeRange” %

%@ Register Assembly=”AjaxControlToolkit” Namespace=”AjaxControlToolkit” TagPrefix=”AjaxCT” %

script src=”AgeRange.js” type=”text/javascript” /script

(arrow tags removed here as it wont display, hint: stackoverflow!!!)

im printing it like this from the server…

Public Sub AppendToSB(ByRef sb As StringBuilder, ByVal CurNo As Byte, Optional ByVal clickedNo As Byte = 0)
    Dim sConfirmClick = ""

    If clickedNo = CurNo Then   ' maybe dont make it clickable...
        sConfirmClick = "return confirm('The number " & CurNo.ToString & " is already selected, are you sure you want to select it again?');"
    End If

    sb.Append("<a href=""#"" onclick=""" & sConfirmClick & "SubmitAge(" & CurNo.ToString & ", '" & upAgeRange.ClientID &
     "')"" runat=""server"">" & CurNo.ToString & "</a>")

End Sub
  • 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-13T07:47:43+00:00Added an answer on May 13, 2026 at 7:47 am

    Complete rewrite of my post after several clarifications:

    The problem is that the ASPX page is referencing an ASCX user control that is located in a different folder. That ASCX control has an HTML <script> tag that is using a relative path to the JS file.

    The solution is to correctly resolve the URL to the JS file by using some extra code:

    <script src="<%= ResolveClientUrl("MyScriptLibrary.js") %>" type="text/javascript">
    </script>
    

    To prevent the script file from being referenced multiple times I recommend using the approaches specified in this other post:
    ASP.NET dynamically insert code into head

    Here’s what it looks like in the user control’s code:

    // Register a script reference: 
    Page.ClientScript.RegisterClientScriptInclude(GetType(), "myLibraryScript", "~/Scripts/MyScriptLibrary.js"); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 300k
  • Answers 300k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer private void menuFont_Click(object sender, EventArgs e) { if (fontDialog1.ShowDialog() ==… May 13, 2026 at 8:00 pm
  • Editorial Team
    Editorial Team added an answer For anybody who stumbles across this "answer," please note that… May 13, 2026 at 8:00 pm
  • Editorial Team
    Editorial Team added an answer Thanks to a nice #boost IRC user (mjcaisse), I have… May 13, 2026 at 8:00 pm

Related Questions

I have JS function which parses through a table: // id contains a message
Using tinyMCE jquery version. I have a content page where there could be many
I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
This problem is happening is both IE8 and IE7. I have a small swf
I have a js function which has, until now, always been the callback for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.