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

The Archive Base Latest Questions

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

I was wondering if someone could help me with a bit of javascript and

  • 0

I was wondering if someone could help me with a bit of javascript and MVC. To give a bit of background…in my application there are a number of Groups, which have individual shops under the umbrella of those groups. Previously, a user could select each individual shop, however I want to change the application to have the user just select the group. This in turn would select all the individual shops under that group as the underlying workings of the application must remain the same.

Here is the existing HTML page…I have changed the style of the checkboxes of the individual shops to be hidden. There is also some javascript which checks all, or unchecks all the shops under the Group header. The bit of help I need on the javascript now is, if the user hits select, the select link becomes disabled and vice versa for the deselect link.

If anyone could help I’d be very grateful. If more info is needed just ask!

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function select(sectionId) {
            toggle(sectionId, "checked");
        }

        function deselect(sectionId) {
            toggle(sectionId, null);
        }

        function toggle(sectionId, checked) {
            $('[section$=' + sectionId + ']').each(function () { $(this).attr('checked', checked); });
        }

    </script>
    <div>
        <% int i = 0; %>
        <% Html.BeginForm(); %>
        <% { %>
        <% foreach (myApp.Web.Models.ShopGroup g in Model.Groups) %>
        <% { %>
        <div style="width:800px;">
            <div style="border-bottom: 1px solid;">
                <div style="font-weight: bold; width: 300px; float: left;">
                    <%: g.GroupHeader%>
                </div>
                <div style="line-height: 18px; vertical-align: middle; width: 250px; float: left;">
                    <a id="select" href="javascript:select(<%: i %>)" <%: ViewData["GROUP_ALL_SELECTED_" + g.GroupHeader] %>>
                        Select</a> / <a id="deselect" href="javascript:deselect(<%: i %>)" <%: ViewData["GROUP_ALL_SELECTED_" + g.GroupHeader] %>>
                            Deselect</a>
                </div>
                <div style="clear: both;">
                </div>
            </div>
        </div>
        <div style="margin-left: 10px; margin-top: 10px;">
            <% foreach (myApp.Data.Shop shop in g.Shops) %>
            <% { %>
            <div style="float: left; line-height: 18px; padding: 2px; margin: 2px; vertical-align: middle;
                border: 1px solid; width: 282px;">
                <input type="checkbox" style="display:none;" section="<%: i %>" name="SHOP_<%: shop.ShopID %>" <%: ViewData["SHOP_" + shop.ShopID] %>
                    style="vertical-align: middle; padding-left: 5px;" />
                <%= Html.TrimTextToLength(shop.Name)%>
            </div>
            <% } %>
        </div>
        <div style="clear: both; margin-bottom: 15px;">
            &nbsp;</div>
        <% i++; %>
        <% } %>
        <br />
        <br />
        <div class="btnFooter">
            <input type="submit" value="Update" />
        </div>
        <div style="clear: both;">
        </div>
        <% } %>
    </div>
</asp:Content>
  • 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-25T13:59:52+00:00Added an answer on May 25, 2026 at 1:59 pm

    Expand the deselect and select functions with the following code, respectively:

    $("#deselect").css("visibility", "hidden");
    $("#select").css("visibility", "hidden");
    

    When you want to show the link again:

    $("#deselect").css("visibility", "visible");
    $("#deselect").css("visibility", "visible");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im wondering if someone could help me .... I have 2 images, and i
I was wondering if someone could help me. I have filenames being outputted by
I was wondering if someone could help with the following problem. I have a
I was wondering if someone could help me with some javascript as I'm quite
I was wondering if someone could help me to get this method converted to
Just wondering if someone could help me with the following issue. On my local
I was wondering if someone could help with an example criteria for nhibernate. I
I am wondering if someone could help me with some probably rather simple code,
I was wondering if someone could help me get pointers to solve this problem.
I was wondering if someone could help I've successfully been able to import an

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.