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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:59:32+00:00 2026-06-15T18:59:32+00:00

I’m totally new to Javascript(Jquery) and still a beginner in ASP.NET. I have a

  • 0

I’m totally new to Javascript(Jquery) and still a beginner in ASP.NET.
I have a contentpage that has a gridview gvUsers I made a code for the event RowDatabound that add an “id” in its markup for every rows.
and its rows are clickable and can be selected through javascript in the contentpage page.

  <script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
             <script type="text/javascript">
                 $(function() {

                $('#<%=gvUsers.ClientID%> tr[id]').click(function() {
                    $('#<%=gvUsers.ClientID%> tr[id]').css({ "background-color":  "White", "color": "Black" });
                    $(this).css({ "background-color": "Black", "color": "White" });          
                });

                $('#<%=gvUsers.ClientID%> tr[id]').mouseover(function() {
                    $(this).css({ cursor: "hand", cursor: "pointer" });
                });

            });

                 $(function() {

                var RowID = $('#hdnEmailID').val();
               if (RowID != "0") {
                    $('#<%=gvUsers.ClientID%> tr[id=' + RowID + ']').css({ "background- color": "Black", "color": "White" });
               }

                $('#<%=gvUsers.ClientID%> tr[id]').click(function() {
                    $('#<%=gvUsers.ClientID%> tr[id]').css({ "background-color": "White", "color": "Black" });
                    $(this).css({ "background-color": "Black", "color": "White" });
                    $('#hdnEmailID').val($(this).attr("id"));
                });

                $('#<%=gvUsers.ClientID%> tr[id]').mouseover(function() {
                    $(this).css({ cursor: "hand", cursor: "pointer" });
                });

                });

            </script>

In these scripts, they get the “id” property of the selected row and save it to hdnEmailID…

<INPUT id="hdnEmailID" type="hidden" value="0" runat="server" >

To make the value hdnEmailID displayed in the page I made a code in inside a button click event that has a code like this..

Response.write(hdnEmailID.value);

At first it works pretty fine and displays the “id” of the row that I clicked however after I used this code in a master-content pages
the script returns 0. And it seems that when I click the button..
The masterpage is reloaded and seems the script is reloading too thus returning the default 0
I am not sure if this is really what happened since I’m a beginner in ASP.NET 🙂

  • 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-15T18:59:33+00:00Added an answer on June 15, 2026 at 6:59 pm

    Is because you do not use the rendered id, the error is on this code:

      var RowID = $('#hdnEmailID').val();
    

    and

      $('#hdnEmailID').val($(this).attr("id"));
    

    it sould be as

      var RowID = $('#<%=hdnEmailID.ClientID%>').val();
    

    and

      $('#<%=hdnEmailID.ClientID%>').val($(this).attr("id"));
    

    The id that is rendered by the controls is not the one you see on code behind, when you use it on a single page some time is the same, but when you add it to the master is change dynamically, now on your html rendered code you need to render that dynamic id.

    In asp.net ver 4 there is a parameter on the controls that you can use it to make them static and not change the ClientIDMode ="Static"

    Similar:
    How do I access a DIV from javascript, if ASP.NET mangles its ID?
    Accessing control client name and not ID in ASP.NET
    Get clientid in user control from external javascript file
    How to find and modify an asp.net control with JavaScript?

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

Sidebar

Related Questions

I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have an array which has BIG numbers and small numbers in it. I
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.