On the last post regarding this template (see Part 1), I gave a walkthrough on how to fix the "Available Seats" variable when a user unregisters from a course so that the variable would increment.
This time I'm going to give a walkthrough on the simple fix to make it so when a user has registered for multiple courses, when they attempt to unregister from an event through the "Courses I am attending" webpart, they actually get removed from the correct course
There is an error in the XSL for the web part that makes it so when the "Remove" link is clicked, it choose whatever course is listed first and not the specific one that lines up with the "remove" link.
For example: if you had three courses on the list and you clicked "remove" on the second one…it would actually remove you from the first course that was listed (because it was displayed first on the list) instead.
The walkthrough for this is really pretty simple to do, so I'm not going to use screenshots for this one…I'll just walk you through.
Open the "XSL Editor" for the "Courses I am attending" webpart.
Copy/paste the contents into NotePad (or editor of your choice).
Search for the "remove" link (it's in a "td" tag a little past halfway down in the document).
Replace the contents of the "td" with the following:
Change from:
<td class="ms-vb">
<a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}" mce_href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row/@ID}">Remove</a>
</td>
To:
<td class="ms-vb">
<xsl:variable name="CourseID" select="@ID"/>
<a href="Lists/Registrations/Unregister.aspx?ID={../../../Registrations/Rows/Row[@Course_x0020_ID=$CourseID and contains(@Author, $UserID)]/@ID}">Remove</a>
</td>
This adds a section that will match up the "Remove" link to the ID of the actual listing and make the removal work correctly.
****Thanks to Yannis on MSDN Blogs to pointing out this fix.****