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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:18:04+00:00 2026-05-16T00:18:04+00:00

I’m having an issue where in my controller, I’m setting values in a collection

  • 0

I’m having an issue where in my controller, I’m setting values in a collection and storing them in ViewData. eg:

ViewData["ex1"] = new SelectList(ex1); // a simple collection
ViewData["ex2"] = new SelectList(group.Members, "Id", "Gender");

I’m passing these to my View and looping through like this. eg:

<div id="divListBox" style="overflow:auto; border:1px solid #CCCCCC; padding-left:5px; background-color:white; height: 130px"> 

          <%
            var list = this.ViewData["e2x"] as SelectList;
            var pList = this.ViewData["ex1"] as SelectList;

            foreach (var p in list)
            {
                foreach (var pil in pList)
                  {
                    if(pil.Text.Contains(p.Value)) // ex1 does contains ex2
                    {
                       %>
                        <input id="cbPerson" type="checkbox" value="<%= p.Value %>" />
                        <label for="cbPerson"><%= p.Text %></label>
                        <input id="cbPersonInfo" type="hidden" value="<%= pil.Text %>" /><br />  
                       <%
                    }
                  }
            }
          %>
        </div> ...

and here is my jQuery. eg:

$('#divListBox > input').each(function() {
        var personInfo = $('#cbPersonInfo').val();
        $(this).append($('personInfo'));
            $('*').qtip('hide');
            $('#divListBox label').each(function() {
                $(this).qtip({
                    content: personInfo,
                    show: 'mouseover',
                    hide: 'mouseout',
                    style: {
                        classes: 'ui-tooltip-custom',
                        tip: true
                    },
                    position: {
                        my: 'left bottom',
                        at: 'top right'
                    }
                });
            });
        });

if I set my input type of “hidden” to “text”, I see the correct information for each one. Hoever, when i hover over them, the first information shows as tooltip for all of them. I think it may be my jquery but I’m not too sure. I’ve been dealing with this issue for hours now and still nothing. Can anyone please help?

  • 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-16T00:18:05+00:00Added an answer on May 16, 2026 at 12:18 am

    foreach:

    id="cbPerson" type="checkbox" value="<%= p.Value %>" />
    <label for="cbPerson"><%= p.Text %></label>
    id="cbPersonInfo" type="hidden" value="<%= pil.Text %>" /><br />
    

    means you have several times the same ID (ID is ALWAYS ! unique), so when you do a jquery selec on ID, Jquery selects the first one it finds

    if you wrap your person in a container it is even easier.

    I made a quick adjustment for you which I tested and worked

      %>
        <div class="person">
         <input id="cbPerson" type="checkbox" value="<%= p.Value %>" />
         <label for="cbPerson"><%= p.Text %></label>
         <input id="cbPersonInfo" type="hidden" value="<%= pil.Text %>" /><br />  
        </div>
        <%
    

    <script type="text/javascript">
    // for each container with class person
        $('.person').each(function () {
        //find the input with class cbPersonInfo which is !!!! IN !!!! $(this): $(this) is now the container 
            var personInfo = $(this).find(".cbPersonInfo").val();
            $(this).qtip({
                content: personInfo,
                show: 'mouseover',
                hide: 'mouseout',
                style: {
                    classes: 'ui-tooltip-custom',
                    tip: true
                },
                position: {
                    my: 'left bottom',
                    at: 'top right'
                }
            });
        });
    
    
    </script>
    

    This code means: for each div with class person, find the div inside with class cbPeronInfo and use it’s value for the qtip. (and offcourse hook the qtip to that class)


    @Edit

    actually, for semantic reasons it is better to use a UL instead of a (more logic) but I assume you can figure out how to change that yourself? if you wanted to otherwise give me a sign 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm making a simple page using Google Maps API 3. My first. One marker

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.