Note that there are some explanatory texts on larger screens.

plurals
  1. POBitmap in datasource not showing in asp .net Gridview
    text
    copied!<p>I have a DataTable I'm populating in code, which I add to a DataSet, which is then used to fill a GridView. This works OK apart from a bitmap column I've just added; and I can't see what I'm missing. My guess is I'm going about this completely wrong as it's my first dabble with website code :)</p> <p>Here's the page code for the grid - you can see I'm not specifying individual columns, they just come automatically from the DataSet.</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt; &lt;/asp:ScriptManager&gt; &lt;asp:GridView ID="gridTicketsByGroup" runat="server" CaptionAlign="Left" CellPadding="4" DataSourceID="TicketsByGroupDatasource" Font-Size="Medium" ForeColor="#333333" GridLines="None" Font-Names="Verdana"&gt; &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt; &lt;EditRowStyle BackColor="#999999" /&gt; &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt; &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Font-Size="Medium" HorizontalAlign="Left" /&gt; &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt; &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt; &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt; &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt; &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt; &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt; &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt; &lt;/asp:GridView&gt; &lt;asp:ObjectDataSource ID="TicketsByGroupDatasource" runat="server" SelectMethod="ShowTicketsByGroupReport" TypeName="PhoneMonitor.GroupReport"&gt;&lt;/asp:ObjectDataSource&gt; &lt;asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick"&gt; &lt;/asp:Timer&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>The select method I have just returns the DataSet containing the DataTable:</p> <pre><code>returnedDataSet.Tables.Add(dataRetriever.TicketsByGroupTable); return returnedDataSet; </code></pre> <p>For testing, I've added one bitmap so far. The whole column simply doesn't show though. Column is added like this:</p> <pre><code>TicketsByGroupTable.Columns.Add("Logo", typeof(Bitmap)); row[0] = LoadIcon(rowName); private Bitmap LoadIcon(string ProductName) { string fileName = ""; switch (ProductName) { case "Test": fileName = "PhoneMonitor.Icons.Test.png"; break; } if (fileName != "") { System.Reflection.Assembly thisAss = System.Reflection.Assembly.GetExecutingAssembly(); Bitmap b = new Bitmap(thisAss.GetManifestResourceStream(fileName)); return b; } else return null; } </code></pre> <p>If I preview the table it looks like it's loaded OK: </p> <p><img src="https://i.stack.imgur.com/1ivwC.png" alt="Preview"></p>
 

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