Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to put an indicator of whether a drive is almost full in an ASP .NET Datalist?
    text
    copied!<p>I'm working with datalists and this particular datalist I'm currently working on retrieves data from a database. It queries the drives of a particular PC in the database, and shows its Total and free space. Rows should look like this in the data list:</p> <pre><code> Drive Total Free Label C:/ 84.3 22.2 NFTS D:/ 64.2 21.3 NFTS E:/ 22.2 11.1 DVD </code></pre> <p>The requirement is, If the Free space is 10% or below the font of the row should go red, Green if not. Here is my code:</p> <pre><code>&lt;asp:DataList ID="DataList1" runat="server" BackColor="#FFFF99" BorderColor="Black" BorderWidth="2px" CellPadding="4" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="Small" Font-Strikeout="False" Font-Underline="False" RepeatDirection="Horizontal" style="z-index: 1; left: 421px; top: 137px; position: absolute; height: 132px; width: 495px" ForeColor="#333333" GridLines="Vertical" DataSourceID="DriveInfo"&gt; &lt;FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt; &lt;AlternatingItemStyle BackColor="#FFFBD6" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /&gt; &lt;ItemStyle BackColor="#FFFBD6" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#333333" /&gt; &lt;SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /&gt; &lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&gt; &lt;ItemTemplate&gt; DriveName: &lt;asp:Label ID="DriveNameLabel" runat="server" style="font-weight: 700" Text='&lt;%# Eval("DriveName") %&gt;' /&gt; &lt;br /&gt; Total: &lt;b&gt; &lt;asp:Label ID="TotalLabel" runat="server" Text='&lt;%# Eval("Total") %&gt;' /&gt; &amp;nbsp;GB&lt;/b&gt;&lt;br /&gt; Free: &lt;b&gt; &lt;asp:Label ID="FreeLabel" runat="server" Text='&lt;%# Eval("Free") %&gt;' /&gt; &amp;nbsp;GB&lt;/b&gt;&lt;br /&gt; Label: &lt;asp:Label ID="LabelLabel" runat="server" style="font-weight: 700" Text='&lt;%# Eval("Label") %&gt;' /&gt; &lt;br /&gt; &lt;br /&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&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