I have a div box that slides into view when one of three buttons are clicked: undergrad, masters and certificates. This animation is done with uilang code (for those that don't know what uilang is you can go to uilang.com). When the button is clicked We want a list to dynamically display into the div. The list will be undergrad degrees, masters or certificates.
So the uilang slide animation is working fine. I created a separate button to test if the asp placeholder is working and it is. The list displays fine so I know there is nothing wrong with the sql or anything like that.
Here is code
// index top of page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="online_programs" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
// form and code on index page
<form id="myform" runat="server">
<asp:ScriptManager ID="ScriptManager2" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<script>
function ugradList() {
PageMethods.underGradList();
}
function mList() {
PageMethods.masterList();
}
function cList() {
PageMethods.certificateList();
}
</script>
<label id="underGradButton" onclick="ugradList()" class="toggle-btn"><input type="radio" name="group3" /><i class="fa fa-circle darkgreen"> </i> Undergraduate</label>
<label id="masterButton" onclick="mList()" class="toggle-btn"><input type="radio" name="group3"/><i class="fa fa-circle darkgreen"> </i> Graduate </label>
<label id="certificateButton" onclick="cList()" class="toggle-btn"><input type="radio" name="group3"/><i class="fa fa-circle darkgreen"> </i> Certificate </label>
<asp:Label ID="PrevParentIDLabel" runat="server" Text="0" />
<div id="degree-list">
<ul><asp:PlaceHolder ID="BachelorsPlaceHolder" runat="server" Visible="false" /></ul>
<ul><asp:PlaceHolder ID="MastersPlaceHolder" runat="server" Visible="false" /></ul>
<ul><asp:PlaceHolder ID="CertificatePlaceHolder" runat="server" Visible="false" /></ul>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
// uilang code
<code>
clicking on ".toggle-btn" adds class "show-degree-results" on "#degree-results"
clicking on ".close-results" removes class "show-degree-results" on "#degree-results"
</code>
The problem I have is that when the buttons are clicked it does not display the list! I get the following logs when I inspect:
The server method 'underGradList' failed with the following error: System.NullReferenceException-- Object reference not set to an instance of an object.
The server method 'masterList' failed with the following error: System.NullReferenceException-- Object reference not set to an instance of an object.
The server method 'certificateList' failed with the following error: System.NullReferenceException-- Object reference not set to an instance of an object.
Like I said before I created a test button and pulled out one of the placeholders to test and make sure my other code is working. It worked fine. So I know I do not need help with that, but I am doing something wrong or I am missing something and I am jsut not sure what it is. Below is the C#:
public partial class online_programs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Our sql and other code that is working fine
}
// bachelor function
[System.Web.Services.WebMethod]
public static void underGradList()
{
online_programs currentclass = new online_programs();
currentclass.MastersPlaceHolder.Visible = false;
currentclass.CertificatePlaceHolder.Visible = false;
currentclass.BachelorsPlaceHolder.Visible = true;
}
// Master function
[System.Web.Services.WebMethod]
public static void masterList()
{
online_programs currentclass = new online_programs();
currentclass.BachelorsPlaceHolder.Visible = false;
currentclass.CertificatePlaceHolder.Visible = false;
currentclass.MastersPlaceHolder.Visible = true;
}
// Certificate function
[System.Web.Services.WebMethod]
public static void certificateList()
{
online_programs currentclass = new online_programs();
currentclass.BachelorsPlaceHolder.Visible = false;
currentclass.MastersPlaceHolder.Visible = false;
currentclass.CertificatePlaceHolder.Visible = true;
}
}
I am very new to C# so if there is something missing or if you need more information please just ask. Like I said the other code is working fine. What I have provided is where the issue is. Please help!