Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6792533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:58:54+00:00 2026-05-26T17:58:54+00:00

PLEASE HELP ME TO SOLVE THIS ERROR cs file public partial class Control :

  • 0

PLEASE HELP ME TO SOLVE THIS ERROR

cs file

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 => o.DRIVER_ID).
                  Select(g =>
                            new
                            {
                                DriverId = g.Key,
                                OrderCount = g.Count(),
                                OrderCountWhereNameIsNotNull = 
                                                  g.Count(o => o.RECEIVE_NAME != null)
                            }).ToList();

    DataViewer.DataSource = results;
    DataViewer.DataBind();
}

}

aspx file

<asp:GridView ID="DataViewer" runat="server">
    <Columns>
        <TemplateColumn>
            <ItemTemplate>
<div style='width: <%# Eval("OrderCount") %>' />
            </ItemTemplate>
        </TemplateColumn>
    </Columns>
</asp:GridView>

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

enter image description here

  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 = "<div style='border: 3px solid black; width: " + OrderCount + "px;'>";
    oDiv.InnerHtml += Environment.NewLine + "  <div style='border: 0px; background-color: red; width: " + OrderCountWhereNameIsNotNull + "px;'>&nbsp;</div>";
    oDiv.InnerHtml += Environment.NewLine + "</div>";
    oCell.Controls.Add(oDiv);
    oRow.Cells.Add(oCell);
    tblData.Rows.Add(oRow);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:58:54+00:00Added an answer on May 26, 2026 at 5:58 pm

    Change this

    aspx file

    <asp:GridView ID="DataViewer" runat="server">
        <Columns>
            <TemplateColumn>
                <ItemTemplate>
    <div style='width: <%# Eval("OrderCount") %>' />
                </ItemTemplate>
            </TemplateColumn>
        </Columns>
    </asp:GridView>
    

    to this

    aspx file

    <asp:GridView ID="DataViewer" runat="server">
        <Columns>
            <ItemTemplate>
    <div style='width: <%# Eval("OrderCount") %>' />
            </ItemTemplate>
        </Columns>
    </asp:GridView>
    

    Explanation: The error message does in fact tell you what’s wrong, although it’s cryptic if you don’t know what it means! Here’s a breakdown:

    Parser Error Description: An error occurred during the parsing of a resource required to service this request.

    This means that something went wrong while the ASP.NET engine was examining a source file. The hints are ‘request’ (as in, a web request was made) and ‘during the parsing of a resource’.

    Please review the following specific parse error details and modify your source file appropriately.

    The error is in a file parsed by asp.net, not the C# compiler. This means the problem is in the aspx, not a .cs file.

    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

    Here, something is expecting to contain things which are DataControlFields, but you’ve given it a TemplateColumn, which is a HtmlGenericControl (which isn’t a DataControlField, so isn’t what it wants). So we examine the aspx markup and say, where is there a TemplateControl? And we see that your GridView\Columns collection has a TemplateControl. Whereas (on checking the help) it should be directly containing an ItemTemplate, when you want a templated column. And we’re done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long string, ex: Please help me to solve this problem. This
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
Please help me understand how the process goes. I understand that web browsers contain
Please help, I got this code from googling on how to use mysql dump
It's a well known issue this damn error expected class-name before ‘{’ token Well,
i couldn't solve this. when i execute this program i get the following error
i get an Inflate Exception, android.view.InflateException: Binary XML file line #76: Error inflating class
I just cant find a workarround for this, please help my config.rb in location
Please help! I'm really at my wits' end. My program is a little personal
Please help! Background info I have a WPF application which accesses a SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.