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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:15:33+00:00 2026-06-05T02:15:33+00:00

I have a jQuery function in ASP that I am trying to get the

  • 0

I have a jQuery function in ASP that I am trying to get the client ID of. When It renders the HTML I get this as a result.

[HTML RENDERED]

$("")//ctl00_Content_gvProgramList
                    .tablesorter({ widthFixed: true, widgets: ['zebra'],
                        widgetOptions: {
                            zebra: ["even", "odd"]
                        }
                    })
                    .tablesorterFilter({ filterContainer: $("#filter-box"),
                        filterClearContainer: $("#filter-clear-button"),
                        filterColumns: [0, 1, 2, 3],
                        filterCaseSensitive: false
                    })
                    .tablesorterPager({ container: $("#pager") });

[CODE BEHIND]

        $("<%# gvProgramList.ClientID %>")//ctl00_Content_gvProgramList
                .tablesorter({ widthFixed: true, widgets: ['zebra'],
                    widgetOptions: {
                        zebra: ["even", "odd"]
                    }
                })
                .tablesorterFilter({ filterContainer: $("#filter-box"),
                    filterClearContainer: $("#filter-clear-button"),
                    filterColumns: [0, 1, 2, 3],
                    filterCaseSensitive: false
                })
                .tablesorterPager({ container: $("#pager") });

If i use ct100_Content_gvProgramList all the javascript works like it should, so please don’t post any answers relating to that. I want an answer on how to get the ClientID to show up correctly.


update

I would like to use $('#<%= gvProgramList.ClientID %>'), but I get an error.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). 

Line 16:         Head.Controls.Add(Header())
Line 17:         Head.Controls.Add(Menu())
Line 18:         Foot.Controls.Add(Footer())
  • 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-05T02:15:35+00:00Added an answer on June 5, 2026 at 2:15 am

    Use:

    <%= ... %>
    

    Instead of:

    <%# ... %>
    

    So:

    $('#<%= gvProgramList.ClientID %>') ...
    

    After Update

    Since you’re building/modifying the controls collection in the code-behind aspnet is barfing when you try to Response.Write() (<%= ... %>). Try using a class name instead of the control’s id.

    Or:

    Wrap the <script> ... </script> inside an <asp:placeholder>. This will make the script a child of the place holder instead of the server-side control that is causing the error.

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

Sidebar

Related Questions

I have asp.net generated html code. I want execute jQuery click function when user
Here's the story... I have a jQuery function that does something, this function is
I have a jquery function that should make a calculation based on a textbox
i have a jQuery function that fires on any of two selects tags change
I have a JQuery function that grabs the URL path and adds it as
I have a problem with a master page containing a asp:textbox that I'm trying
We have been wrestling with the confines of ASP.NET trying to get JSONP working.
I have created an IHttpAsyncHandler that I'm trying to call using AJAX, with jQuery.
I have some code on a User Control that looks like this: <asp:PlaceHolder id=ph1
I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id

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.