How can I manage this error? I have a button that dequeued my enqueued objects and then save it in my TempData["QueueNumber"]
then I have a call screen view which get the properties of my TempData
and render it. It's partly working only when I have an object my TempData
but when it's null its starts to throw me the Object reference not set to an instance of an object.
error.
Here is my view:
@{
var item = (Rosh.QueueMe.Web.Models.MyQueue)TempData["QueueItem"];
}
<table id="auto">
<tr style="font-family:'Arial Rounded MT'">
<th class="tickets">TICKETS</th>
<th class="name">NAME</th>
<th class="counter">COUNTER</th>
<th class="service">SERVICE</th>
</tr>
<tr class="data">
<td>#@item.QueueNumber</td>
<td>@item.Name</td>
<td>Desk 1</td>
<td>@item.ServiceId</td>
</tr>
</table>