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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:05:57+00:00 2026-06-11T12:05:57+00:00

In my MVC project I have this Editor Template. I cannot debug it in

  • 0

In my MVC project I have this Editor Template.
I cannot debug it in the IE Developer Tools as it is in a popup window. I do not have access to the other browsers.
So my jquery is not picking up the values for the url, employeeId and the businessUnitId.

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SHP.Models.BusinessUnitSelected>" %>

<tr>
    <td><%: Model.BusinessUnit.BusinessUnitName %></td>
    <td>

    <%: Html.CheckBoxFor( 
            x => x.Selected,
            new RouteValueDictionary 
            { 
                { "data-url", Url.Action("AddBusinessUnitForEmployee", "DataService") }, 
                { "data-employeeId", Model.EmployeeId }, 
                { "data-businessUnitId", Model.BusinessUnit.BusinessUnitId } 
            } 

       ) %> 

    </td>
</tr>
<script type="text/javascript">
    $(document).ready(function () {
        $('tr input[type="checkbox"]').click(function () {
            var elementId = $(this).attr('id');
            alert("elementId = " + elementId);
            var url = $(this).val('data-url');
            alert("url = " + url);
            var employeeId = $(this).val('data-employeeId');
            alert("employeeId = " + employeeId);
            var businessUnitId = $(this).val('data-businessUnitId');
            alert("businessunitId = " + businessUnitId);
            var selectedFlag = $(this).is(':checked');
            alert("selectedFlag = " + selectedFlag);

            dataService.saveSelection(
            employeeId,
            businessUnitId,
            selectedFlag,
            elementId,
            SavedSetting,
            url
        );
        });
    }); 
</script>
  • 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-11T12:05:59+00:00Added an answer on June 11, 2026 at 12:05 pm

    .val() is used to get/set the value attribute, you should use .attr() instead:

    eg. $(this).attr('data-url');

    edit

    @Dima Suggests the correct way to access HTML5 data-* attributes – by using .data(), eg. $(this).data('url');

    note: You should hyphenate words in your data- attributes otherwise you’ll have trouble reading their values when using .data(). See below:-

    <input type="text" data-employeeId="1" />
    
    console.log($('input[type="text"]').data('employeeId')); // (undefined!)
    

    This is because $('input[type="text"]').data('employeeId') is trying to read data-employee-id, using the latter you can then access the data using .data('employeeId') or .data('employee-id').

    All data-* names are stored in camelCase in the jQuery data object,
    using W3C rules.

    So, data-caMEL-case becomes the camelCase property in the data object
    and should be accessed using .data("camelCase"). Because many people
    will use .data("camel-case") instead, we convert that to camelCase as
    well, but only if no data item named camel-case is found so it’s
    faster to use the first form. If you get the entire data object using
    code like data = jQuery.data(elem), you must use data.camelCase to
    access the data item.

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

Sidebar

Related Questions

This is a MVC 3 project. Just for testing, I have public class MyRoleProvider
Using MVC 2 I have been trying to make this record store project. Creating
I have this sample MVC project using jQuery grid. There is only one problem
I have this code in my ASP.NET MVC project master page: <% switch(Request.Browser.Browser) {
I have this new mvc project where all beans are default scoped(no prototype or
I have this ASP.net MVC project that requires a wizard like interface... So I
I have a web project (mvc) and data access layer in a separated class
I have this working in an MVC project on IIS by adjusting the hosts
In my MVC project I have a chart being generated on my view as
In our ASP.NET MVC project we have a Strings.resx file and the accompanying autogenerated

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.