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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:34:37+00:00 2026-06-12T00:34:37+00:00

I have a textbox; <input runat=server type=hidden value=0 id=input1 name=input1_name> I have a div;

  • 0

I have a textbox;

<input runat="server" type="hidden" value="0" id="input1" name="input1_name">

I have a div;

<div id="div1"> some content </div>

I have a seperate .js file where I have a function which is loaded at the Page Load. In that function I have:

$("#div1").click(function(e){
definition;
});

I want to pass the client id of the input control mentioned above to the click handler in the above scenario.I have not been able to use the property ClientID on the above mentioned javascript file. Rest all is working fine.

Please advise how do I pass parameters to the click handler of a control on aspx page to the javascript file (in a way getting ClientID there).

This is on .NET.

Please let me know in case I need to post any more details here, if anything look ambiguous.

  • 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-12T00:34:39+00:00Added an answer on June 12, 2026 at 12:34 am

    Depending on which version of ASP.NET you use you have a couple of options.

    Before ASP.NET 4.0 you can do something like this:

    <script type="text/javascript">
        function DoSomething(){
            alert('<%= Control.ClientID %>');
        }
    </script>
    

    In ASP.NET 4.0 a new feature was introduced: ClientIDMode:

    <asp:TextBox ID="myCustomId" runat="server" Width="65%" ClientIDMode="Static" />
    

    will output:

    <input id="myCustomId" style="width: 65%" name="ctl00$MasterPageBody$ctl00$txtEcho2" />
    

    If you use the static ClientIDMode you can use the Id in your JavaScript without any problems.

    Here is a nice blog that explains the different options: ASP.NET 4.0 ClientID Overview

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

Sidebar

Related Questions

I have this code for Form Submit.. <input type=submit runat=server id=buttonSubmit value=Add style=width:100px; />
I have a asp.net input box: <asp:TextBox ID=InCL runat=server Text=></asp:TextBox> As soon as a
I have to filter user input to on my web ASP.NET page: <asp:TextBox runat=server
Here is my code, simplified: <form id=form1 style=height: 759px runat=server> <%= Html.TextBox(txtDateFrom)%> <input type=button
I have asp.net page (Form = runat server ) 2 textboxes: <input type=text id=tb1
<asp:Textbox runat=server Id=Username /> This might render as: <input type=text id=ctl00_mainContent_Username /> But in
How to rewrite Webconfig connection string at runtime.I have input textbox for Server,UserName and
I have a page setup like so: <ajax:UpdatePanel id=UpdatePanel1 runat=server UpdateMode=Conditional> <ContentTemplate> <asp:TextBox id=TextBox1
If in the markup you declare a control like this: <asp:Label runat=server AssociatedControlID=txtSomeInput>Some Input:</asp:Label>
I have a TextBox input element that has a RequiredFieldValidator as such: <div> <label>First

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.