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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:43:30+00:00 2026-06-07T13:43:30+00:00

below is the html code for a button in my asp.net application which uses

  • 0

below is the html code for a button in my asp.net application which uses vb as its serverside language. The button is handled on the server side, in which the code is listed below as well. My issue is when I add an onclick event (I want to call a javascript function, either in the same page or in the parent as this page is only displayed in an iframe in our application, never stand alone).

Currently, this is the html for the button

<asp:button class="smalltextbutton" id="Button1" runat="server" Text="Save"></asp:button>

When changed to the following below, I get an error when the page is launched stating “Compiler Error Message: BC30456: ‘refreshParentTree’ is not a member of ‘ASP.tasks_modifytask_aspx’.
“

<asp:button class="smalltextbutton" id="Button1" OnClick="refreshParentTree()" runat="server" Text="Save"></asp:button>

and for now the javascript function is very basic, outside of the form, here is what it looks like.

<script language="javascript">
 function refreshParentTree(){
        alert('refresh parent tree hit');
        }
</script>

On the server side, here is my code that handles the button click (vb)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'DEBUG: 
    If Trace.IsEnabled Then cGK_testSpot.Text += "<div style='border: solid thin orange;'>Button1_Click() STARTING<br>"
    'DEBUG: 
    If Trace.IsEnabled Then cGK_testSpot.Text += "<div style='border: solid thin green;'>printArrayList (delete ALL EXCEPT this list from P2_CustomFields_Detail): " + CustomFieldsLibrary.printArrayList(arlist_dynCompnts) + "</div>"

    If Page.IsValid Then
        CustomFieldsLibrary.deleteAllDynamicFieldsExceptThisList(lnCurrent, 13, -1, arlist_dynCompnts, (New SqlConnection((New ConnInfo).GetConnString)), True)
        UpdateDatabase()
        If Not Trace.IsEnabled Then Server.Transfer("viewTask.aspx?taskgrpid=" & lnCurrent & "&taskgrpcategory=13&ptaskgrpid=" & Request.QueryString("ptaskgrpid") & "&ptaskgrpcategory=" & Request.QueryString("ptaskgrpcategory") & "&refresh=true")
    Else
        populateDropDowns()
    End If

    If Trace.IsEnabled Then cGK_testSpot.Text += "<div style='border: solid thin green;'>printArrayList: " + CustomFieldsLibrary.printArrayList(arlist_dynCompnts) + "</div>"
    'DEBUG: 
    If Trace.IsEnabled Then cGK_testSpot.Text += "<br>Button1_Click() ENDED</div>"
End Sub

So basically, I am looking for what was done incorrectly here as to why the page is giving me errors, and once these are resolved, I will need the onclick to also call a javascript function either on the same page, which then will call the parent, or the parent directly. Thank you for your help.

  • 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-07T13:43:32+00:00Added an answer on June 7, 2026 at 1:43 pm

    Use OnClientClick instead of OnClick.

    An <asp:button> is a server-side element, so it has its own ASP.NET-specific server-side attributes which are processed, well, server-side. So OnClick isn’t what you think it is in terms of regular HTML elements. The compiler is looking for that code on the server, and it’s not there.

    OnClientClick, on the other hand, is just treated as a string and isn’t evaluated by the compiler. (Except to emit the onclick HTML attribute in the output.) It assumes that there will be client-side code to handle it.

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

Sidebar

Related Questions

I have below HTML code <table class=innerGridTable cellpadding=0 cellspacing=0 width=100%> <tr id=trMain> <td> <asp:Button
I have below is the html code for TD which gets appended after matching
I am writing a very simple HTML code which is listed below. Written in
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have an asp.net web form with an html input and button at the
my aspx (html) code is like below : this is first button (something that
In my code attached below, I'm trying to upload a file via ASP.NET. I
Please see the below code: I am have a table row defined using asp.net
I Disable a textbox by c# code in an ASP.net Page with below code:
I Have the below Asp.net Code: the problem is that When Timer Tick Every

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.