Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity framework Parser Error
    primarykey
    data
    text
    <p>PLEASE HELP ME TO SOLVE THIS ERROR</p> <p><strong>cs file</strong></p> <pre><code>public partial class Control : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { OrderDataRepository rep = new OrderDataRepository(); var results = rep.GetAllOrderData(). GroupBy(o =&gt; o.DRIVER_ID). Select(g =&gt; new { DriverId = g.Key, OrderCount = g.Count(), OrderCountWhereNameIsNotNull = g.Count(o =&gt; o.RECEIVE_NAME != null) }).ToList(); DataViewer.DataSource = results; DataViewer.DataBind(); } } </code></pre> <p><strong>aspx file</strong></p> <pre><code>&lt;asp:GridView ID="DataViewer" runat="server"&gt; &lt;Columns&gt; &lt;TemplateColumn&gt; &lt;ItemTemplate&gt; &lt;div style='width: &lt;%# Eval("OrderCount") %&gt;' /&gt; &lt;/ItemTemplate&gt; &lt;/TemplateColumn&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p><strong>Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'. 'TemplateColumn' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl</strong></p> <p><img src="https://i.stack.imgur.com/uhy0F.jpg" alt="enter image description here"></p> <pre><code> int OrderCount, OrderCountWhereNameIsNotNull; System.Web.UI.WebControls.TableRow oRow; System.Web.UI.WebControls.TableCell oCell; System.Web.UI.HtmlControls.HtmlGenericControl oDiv; while (true) //loop through records //do while not eof { oRow = new System.Web.UI.WebControls.TableRow(); oCell = new System.Web.UI.WebControls.TableCell(); oDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); OrderCount = 200; //get value from DB, convert to meaningful width OrderCountWhereNameIsNotNull = 100; //get value from DB, convert to meaningful width oDiv.InnerHtml = "&lt;div style='border: 3px solid black; width: " + OrderCount + "px;'&gt;"; oDiv.InnerHtml += Environment.NewLine + " &lt;div style='border: 0px; background-color: red; width: " + OrderCountWhereNameIsNotNull + "px;'&gt;&amp;nbsp;&lt;/div&gt;"; oDiv.InnerHtml += Environment.NewLine + "&lt;/div&gt;"; oCell.Controls.Add(oDiv); oRow.Cells.Add(oCell); tblData.Rows.Add(oRow); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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