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

  • Home
  • SEARCH
  • 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 4532052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:58:51+00:00 2026-05-21T13:58:51+00:00

i am looking for the best selector (jquery) in content pages ! i found

  • 0

i am looking for the best selector (jquery) in content pages !

i found the below selectors , but what is better and i should use that in .net 4?

        alert($('#hfFirstTimePageLoad').val()); -> NOT Ok
        $('#ContentPlaceHolder1_hfFirstTimePageLoad').val("This Is A Test"); -> Ok
        alert($('#ContentPlaceHolder1_hfFirstTimePageLoad').val()); -> Ok
        alert($('#<%= hfFirstTimePageLoad.ClientID%>').val()); -> Ok

thanks for leading me

  • 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-21T13:58:52+00:00Added an answer on May 21, 2026 at 1:58 pm

    In .NET 4 you can set your controls to use ClientIdMode Static and this should make the Id’s appear as you define them. That’s my preferred way if using .NET 4.

    You can place the property on the element itself, the master page or in the web config

    //On the Control
    <asp:Button ID="Button1" runat="server" Text="Button" ClientIDMode="Static" />
    
    //Master Page and web.config (all controls)
    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs"   
        Inherits="WebApplication2.SiteMaster" ClientIDMode="Static" %>
    
    <system.web>
        <pages clientIDMode="Static"></pages>
    </system.web>
    
    //HTML
    <input id="Button1" type="submit" value="Button" name="ctl00$MainContent$Button1">
    

    http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx

    https://www.west-wind.com/weblog/posts/54760.aspx

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

Sidebar

Related Questions

I'm looking for best-practices for designing a site that with accessibility in mind. The
I'm looking for the best way to log errors in an ASP.NET application. I
I'm looking for any way that I can improve the selector performance of a
Looking for the best way to GET the xpath and css selector of a
I am looking for a most efficient way to re-use widgets with different selectors...
I'm looking for suggestions on how to go about adding a ListView selector that
Thats pretty much it. Looking for best practice with mobile jQuery caching. Thanks for
I looking for the best way to implement a block that lists all terms
I'm looking for the best way to check that an NSString contains both numerical
Looking for best practice focused answers here with explanations. Should the presentation layer of

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.