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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:43:14+00:00 2026-05-27T11:43:14+00:00

I have made a web user control (.ascx) which consists of the two html

  • 0

I have made a web user control (.ascx) which consists of the two html textbox and two input buttons, when I try to do document.getElementById('<%=ControlID.ClientID%>') it returns null. what could i have done wrong ?

source code:

<script language="javascript" type="text/javascript">

    function intilize() {
        var x = document.getElementById('<%=JSNumeric_Control.ClientID%>');
    }

</script>

<table class="style1">
    <tr>
        <td >
        <My:UserInfoBoxControl ID="JSNumeric_Control" runat="server" />
            </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" style="text-align: center">
            <input id="Button1" type="button" value="button" onclick="intilize()" /><br />
            </td>
    </tr>
</table>

Here is the code for the Numbric.cs, the following are the property used and in page load i am using JavaScript to assign all the events for the HTML inputs:

public partial class NumricCounter : System.Web.UI.UserControl
    {
        public string defualtValue = "0";
        public double defaultIncrementValue = 1;
        public int defaultPrecsionValue = 0;

        public string Button_Add_ClientID
        {
            get { return Button_Add.ClientID; }
        }

        public string Button_Subtract_ClientID
        {
            get { return Button_Subtract.ClientID; }
        }

        //Set and Get for all these properties. (Code Omitted)
        public string Text;

        public double IncrementValue;

        public int PrecsionValue;

        public void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Text_Output.Value = this.Text;
                Button_Add.Attributes.Add("onclick", "Add(" + IncrementValue.ToString() + "," + PrecsionValue.ToString() + ");");
                Button_Subtract.Attributes.Add("onclick", "Subtract(" + this.IncrementValue.ToString() + "," + this.PrecsionValue.ToString() + ")");
                Text_Output.Attributes.Add("onkeyup", "check(" + this.PrecsionValue.ToString() + ");");
            }
        }
    }
  • 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-27T11:43:15+00:00Added an answer on May 27, 2026 at 11:43 am

    Try replacing your function:

    function intilize() {
            var x = document.getElementById('<%=JSNumeric_Control.ClientID%>');
        }
    

    with this:

    function intilize() {
            var x = document.getElementById('JSNumeric_Control');
        }
    

    The getElementById should read the ID of the element from the rendored html.

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

Sidebar

Related Questions

I have made a little app for signing up for an event. User input
I have made a website on which a user has to log in using
i have made a small web application with form.html output.jsp ServletOne.java In the form.html,users
I have a use control which contains some ajax functionality. I made all necessary
I have made a form which adds controls dynamically with user selecting the type
I have created a user control with web controls defined in the aspx file
I have made a web application that uses master page for Login & Logout
Background I have made a Web Service in Visual Studio, and I'm trying to
I have made a build system for my web application that's rewriting all resource
I have made an app that gets an array of addresses from a web

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.