I am new to Tridion and I need to remove the dropdown from the control and the moment i do that the file gives null exception error.
Control code:
<%@ Control Language="C#" AutoEventWireup="true" Inherits="xxx.Codebehind.Controls.Listing" %>
<%@ Register Assembly="xxx.Codebehind" Namespace="xxx.Codebehind.Utilities" TagPrefix="xxx" %>
<section class="articlesList">
<p><%=subHeading%></p>
<h2><%=titleText%></h2>
<div class="liner">
<label>##resultsPerPage##:</label>
<asp:DropDownList runat="server" ID="ResultsPerPage" CssClass="resultsPerPage" AutoPostBack="true">
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Selected="True" Value="10">10</asp:ListItem>
<asp:ListItem Value="15">15</asp:ListItem>
<asp:ListItem Value="20">20</asp:ListItem>
<asp:ListItem Value="25">25</asp:ListItem>
<asp:ListItem Value="30">30</asp:ListItem>
<asp:ListItem Value="35">35</asp:ListItem>
<asp:ListItem Value="40">40</asp:ListItem>
<asp:ListItem Value="45">45</asp:ListItem>
<asp:ListItem Value="50">50</asp:ListItem>
</asp:DropDownList>
</div>
<table class="layout">
<thead>
<tr>
<th>##documentArticle##</th>
<th>##date##</th>
</tr>
</thead>
<tbody>
<asp:ListView runat="server" ID="PressReleases" >
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<ul class="linkList">
<li>
<a <%# ((PressReleaseItem)Container.DataItem).URLMarkup %> ><%# ((PressReleaseItem)Container.DataItem).Title %></a>
</li>
</ul>
</td>
<td><%# ((PressReleaseItem)Container.DataItem).Date.ToString("dd MMM yyyy") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
</tbody>
</table>
</section>
I removed all the references of the dropdown from the codebehind. It doesn't give any error or even the page is fine. But the moment i remove the the dropdown from this file it gives null exception error.
The code that i commented from the codebehind is
//DropDownList ResultsPerPage = base.FindControl("ResultsPerPage") as DropDownList;
//itemsPerPage = int.Parse(ResultsPerPage.SelectedValue);
Any idea what may be the issue or how these dropdowns are working?