Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying "Empty" record templates in ASP.NET Listview
    text
    copied!<p>I'm currently coding a web application using ASP.NET. So far my use of ASP.NET and the application has been going great, however there is one feature I would love to have, but I cannot for the life of me figure out how to do it.</p> <p>I want to use some sort of list/form view, which will show both data records and empty blank templates. For example, I want to use this as an "event booking" system, where the user would click an open slot and this would then be registered to our database. This open slot is the empty template I would like.</p> <p>I've done a quick paint picture to illustrate what I mean:</p> <p><img src="https://i.imgur.com/EBKx2ks.png" alt="http://imgur.com/EBKx2ks"></p> <p>I assume that I'm in the right direction using a ListView, but I would like some feedback/help on a better method to achieve this.</p> <p>This is my listview code (it is somewhat basic, barebones almost):</p> <pre><code>&lt;asp:ListView ID="LV_AvailableUpdateSlots" runat="server" ItemPlaceholderID="itemPlaceholder"&gt; &lt;LayoutTemplate&gt; &lt;asp:PlaceHolder ID="itemPlaceHolder" runat="server"&gt;&lt;/asp:PlaceHolder&gt; &lt;/LayoutTemplate&gt; &lt;EmptyDataTemplate&gt;No data for this date.&lt;/EmptyDataTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Panel ID="Pnl_AvailableSlot" runat="server" CssClass="UpdateDiarySlotPanel"&gt; &lt;div class="FloatLeftInline"&gt; &lt;asp:Label ID="Lbl_ClientName" runat="server" Text="Name: "&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="Lbl_ClientNameEval" runat="server" Text='&lt;%# Eval("RefID") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;asp:Label ID="Lbl_ClientProductEval" runat="server" Text='&lt;%# Eval("ClientMainProductID") %&gt;'&gt;&lt;/asp:Label&gt; &lt;div class="FloatRightInline"&gt; &lt;asp:Label ID="Lbl_Version" runat="server" Text="Version: "&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="Lbl_VersionEval" runat="server" Text= '&lt;%# Eval("Version") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;/ItemTemplate&gt; &lt;InsertItemTemplate&gt; Insert here. &lt;/InsertItemTemplate&gt; &lt;EmptyItemTemplate&gt;No data found.&lt;/EmptyItemTemplate&gt; &lt;/asp:ListView&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload