Using Jquery UI Accordion in an ASP.NET application

Struggling with implementing the 'accordion' script from JqueryUI on my asp.net page .aspx.

I'm having trouble finding comprehensive documentation for the accordion in this context, only basic HTML

<p><h3><div> etc...

Here's an example of the code on the aspx page:

<%@ Page Language="C#" MasterPageFile="~/Zulcon_ppal.Master" AutoEventWireup="true"    CodeBehind="EnvianosTuCurriculum.aspx.cs" Inherits="Grupo_Zulcon.EnvianosTuCurriculum" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( "#accordion" ).accordion({
  heightStyle: "content"
});
});
</script>
<style type="text/css">
.curriculumContainer
{
width:90%;
color:#646464;
margin:30px auto;
}     and then more page specific css... </asp:Content>

However, when I try to use a title within a <div>, nothing seems to be happening:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div class="fixed-width-wrapper contentContainer">

<div style="padding:20px">
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc; background-image:url('images/menuzulcon3.png'); height: 59px; width: 953px;" class="titulosGeneral";></div>
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc" class="titulosGeneral">Bachillerato</div>
  <div class="curriculumdivcompleto">
  <div id="accordion">
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Location (City, Country)</div>
    <div style="margin-top:5px"><asp:TextBox ID="Loc_prim" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistro2">
    <div style="margin-top:10px" class="autenticacionTitulo">Institution Name</div>
    <div style="margin-top:5px"><asp:TextBox ID="Insti_prim" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Year of Graduation</div>
    <div style="margin-top:5px"><asp:TextBox ID="year_prim" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistro2">
    <div style="margin-top:10px" class="autenticacionTitulo">Years Completed</div>
    <div style="margin-top:5px"><asp:TextBox ID="completed_prim" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div>&nbsp;</div>
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc" class="titulosGeneral">Higher Education</div>
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Location (City, Country)</div>
    <div style="margin-top:5px"><asp:TextBox ID="Loc_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistro2">
    <div style="margin-top:10px" class="autenticacionTitulo">Institution Name</div>
    <div style="margin-top:5px"><asp:TextBox ID="Name_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Degree Earned</div>
    <div style="margin-top:5px"><asp:TextBox ID="degree_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq2">
    <div style="margin-top:10px" class="autenticacionTitulo">Year of Graduation</div>
    <div style="margin-top:5px"><asp:TextBox ID="year_sec" runat="server" MaxLength="25" ValidationGroup="Curriculum" CssClass="autenticacionTextBoxReducido"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq3">
    <div style="margin-top:10px" class="autenticacionTitulo">Completed Semesters</div>
    <div style="margin-top:5px"><asp:TextBox ID="Semester_sec" runat="server" MaxLength="25" ValidationGroup="Curriculum" CssClass="autenticacionTextBoxReducido"></asp:TextBox></div>
  </div>
</div>
  </div>
    <div style="text-align:right; margin-top:20px"><asp:Button ID="Button3" runat="server" ValidationGroup="Curriculum" postbackurl="Envia4.aspx" OnClick="Register" CssClass="my_btn"/></div>
  </div>
  </div>

</asp:Content>

If anyone has any insight into what may be going wrong, I would greatly appreciate it.

Thank you in advance.

Answer №1

Discovered this gem on the official documentation page, in case it fits your needs

Your accordion container's structure should consist of pairs of headers and content panels:

<div id="accordion">
<h3>First header</h3>
<div>First content panel</div>
<h3>Second header</h3>
<div>Second content panel</div>
</div>

While accordions allow for various markup options, each content panel always needs to be placed immediately after its associated header. Refer to the header option for guidance on utilizing custom markup structures.

RECENT UPDATES:

<div class="fixed-width-wrapper contentContainer">

<div style="padding:20px">
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc; background-image:url('images/menuzulcon3.png'); height: 59px; width: 953px;" class="titulosGeneral";></div>
  <div class="curriculumdivcompleto">
  <div id="accordion">
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc" class="titulosGeneral">High School Diploma</div>
  <div>
    <div class="curriculumLadoRegistroizq">
      <div style="margin-top:10px" class="autenticacionTitulo">Location (City, Country)</div>
      <div style="margin-top:5px"><asp:TextBox ID="Place_pri" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
    </div>
    <div class="curriculumLadoRegistro2">
      <div style="margin-top:10px" class="autenticacionTitulo">Institution Name</div>
      <div style="margin-top:5px"><asp:TextBox ID="Insti_pri" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="autenticacionTextBox"></asp:TextBox></div>
    </div>
    <div class="curriculumLadoRegistroizq">
      <div style="margin-top:10px" class="autenticacionTitulo">Graduation Year</div>
      <div style="margin-top:5px"><asp:TextBox ID="year_pri" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
    </div>
    <div class="curriculumLadoRegistro2">
      <div style="margin-top:10px" class="autenticacionTitulo">Years Attended</div>
      <div style="margin-top:5px"><asp:TextBox ID="attended_pri" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
    </div>
  </div>
  <div>&nbsp;</div>
  <div style="padding-bottom:5px; border-bottom:solid 1px #cccccc" class="titulosGeneral">Higher Education Studies</div>
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Location (City, Country)</div>
    <div style="margin-top:5px"><asp:TextBox ID="Loc_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistro2">
    <div style="margin-top:10px" class="autenticacionTitulo">Institution Name</div>
    <div style="margin-top:5px"><asp:TextBox ID="Name_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq">
    <div style="margin-top:10px" class="autenticacionTitulo">Degree Obtained</div>
    <div style="margin-top:5px"><asp:TextBox ID="degree_sec" runat="server" MaxLength="100" ValidationGroup="Curriculum" CssClass="authenticationTextBox"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq2">
    <div style="margin-top:10px" class="autenticacionTitulo">Year of Graduation</div>
    <div style="margin-top:5px"><asp:TextBox ID="year_sec" runat="server" MaxLength="25" ValidationGroup="Curriculum" CssClass="authenticationTextBoxReduced"></asp:TextBox></div>
  </div>
  <div class="curriculumLadoRegistroizq3">
    <div style="margin-top:10px" class="autenticacionTitulo">Semesters Completed</div>
    <div style="margin-top:5px"><asp:TextBox ID="Semester_sec" runat="server" MaxLength="25" ValidationGroup="Curriculum" CssClass="authenticationTextBoxReduced"></asp:TextBox></div>
  </div>
</div>
  </div>
    <div style="text-align:right; margin-top:20px"><asp:Button ID="Button3" runat="server" ValidationGroup="Curriculum" postbackurl="Submit4.aspx" OnClick="Register" CssClass="my_btn"/></div>
  </div>
  </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The value for MapControllerRoute cannot be left empty

After starting a web-api project on my Macbook in Windows mode, everything was working fine. However, when I downloaded the same project from Github to my Windows PC, I encountered an error upon starting the program. Below is the code snippet from my Macc ...

Looking for a way to retrieve JSON data from an HTML page using JavaScript? Look no further

There is a page that sends me JSON data. You can make the request using the GET method: or using the POST method: argument --> unique_id=56d7fa82eddce6.56824464 I am attempting to retrieve this information within my mobile application created with I ...

Switch up the box-shadow color with ColorThief!

Is there a way to adjust this script to change the box-shadow color of #player1? <script type="text/javascript> $(window).ready(function(){ var sourceImage = document.getElementById("art"); var colorThief = new ColorThief(); var color = ...

PHP implementation for updating JSON data

I have a JSON file that requires updating its numerical values before writing it to a new file. Here is an example of the script: [ { "type": "flipImage", "image": "img/new.jpg", "trigger": "{{10,80},{300,350}}", "animationDuration": ...

Once the content of a page is retrieved through an AJAX request, I am able to access and select tag elements, however, I am unable to

After making an AJAX request, I received an HTML page $.ajax({ async: true, method: 'GET', url: linkPage, // cache: true, success: function (data) { console.log(data); } }); The received data is ...

Adjusting Size of Picture and Text on Card

I am currently testing out different effects using the materializecss framework. My goal is to adjust the size of the image and content on a card when the user hovers over it, but I'm having trouble figuring it out. .card:hover .card-image { he ...

Product pages created with PHP, such as displaying as: Page: [1] 2 3 4

I am working on a product page created with WordPress that fetches products and displays them. However, I want to restrict the number of products visible at once. Code for generating with WordPress/PHP: $pages = get_pages(array('parent' => $ ...

Show representation in UTF-8 character set

In order to display my model in JSON format, I am using: @Html.Raw(Json.Encode(Model.Events)) My server-side model looks like this: {"Title":"Party","Url":"site.com/events?id=1&view=table"} However, on the client side, the JSON appears as: {"Title ...

Harnessing the power of the Zurb Foundation 4 grid system to create visually appealing list elements

When it comes to styling the layout of a page, Foundation 4's grid system with its mobile-first approach is a no-brainer, especially if you're already using other foundation elements like textual content, images, and sidebars. On the example pag ...

Retrieve CSS styles from an element and all of its descendants in a recursive manner

I am looking to achieve the following functionality: getRecursiveCSS(document.getElementById('#menubar')) When called, this function should return a string of CSS for the main element and all its child elements. I have attempted the following ...

WordPress CSS & JS files failing to enqueue properly

My attempt to integrate my CSS and JS files with WordPress has not been successful. Although my CSS works through the Custom CSS tab, this is not an ideal solution. Below is the code from my functions.php file for your reference. Can you help me troublesho ...

ceasing the execution of a setTimeout function

Check out this simple image slideshow I created. Here's the link to view it on jsfiddle. Everything seems to work fine when you click start, but when you click stop, the function keeps running. Take a look at the jQuery code below: $(document).ready ...

Utilize CSS/SCSS to apply dynamic styles in Vue components

Currently, I am utilizing animate.css in my project. One of the components, a v-flex element, is structured as follows: <v-flex md3 sm6 xs12 v-for="(d, index) in data" :key="organization.id" class="animated fadeInLeft" :style="{ 'anim ...

Comparison between Page Refresh and IsPostBack

I have a scenario where my index page redirects users to an edit products page on separate tabs in the browser. Each time a product is edited, the index updates the Session["ProductID"]. On the Edit page, I have implemented the following code to generate ...

The clingy navigation bar hinders smooth scrolling to the content

My website has an image where users can click on elements to scroll down to text. However, I'm facing a problem because there is a sticky menu at the top of my website. How can I ensure that the scrolling works correctly with the sticky menu included? ...

How can I extract the {"Europe":{"France":"Paris","UK":"London","Germany":"Berlin"}} JSON object in C# and retrieve the actual object values as keys?

Update: I am in the process of reformulating my question. I have a database as a data source for continent, country, and capital lists. From this data, I need to create a JSON object with a specific structure. I need to design a Dto (Data Transfer Object) ...

What is the best way to iterate through a JSON object using the stages array provided?

I am facing an issue with parsing the provided json to display the desired output on the screen. These are the steps I need to follow for parsing this json: 1. Extract the stages array from the json - for example, stages ["check_dependency_progress", "sh ...

Transforming a div into image data with the power of jQuery

I am facing a challenge with my HTML page. I have implemented a button that is supposed to convert the entire HTML page into an image when clicked. So far, I have used html2canvas for this purpose as shown below: html2canvas([document.getElementById(&apos ...

New replacement for the .selector method that has been eliminated in JQuery version 3.0

The JQuery version 3.0 has permanently removed the .selector property, leaving me confused about what to use as a replacement for it. I currently have utilized the .selector like this in my code: var TaxYearNode = $(EmployerLatestYear).find("TaxYear&q ...

The vertical tab is not appearing correctly within the modal across various browsers

While attempting to showcase a vertical tab inside a Bootstrap 4 Modal, I've encountered an issue where the same modal appears differently in Google Chrome versus Firefox browsers. Here is the code I am utilizing: <!-- Latest compiled and minif ...