?
Solved

Manually adjusting asp.net code gives parser error

Posted on 2014-11-06
3
Medium Priority
?
299 Views
Last Modified: 2014-11-08
I am trying to learn asp.net after creating a bunch of pages using asp 3.0. To do this I am using Visual Studio Express 2013 for web, dragging tables to create grid views, and then looking at the code in hopes of better understanding so I can eventually hand code.

So I use the gridview tasks > edit columns and change the item style to give a column a specific width. That works. I then go to the code and manually do the same thing for another column. When I run it in my browser I get this:

Server Error in '/portal2' Application.

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'. 'ItemStyle' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Source Error:


Line 29:                 <asp:BoundField DataField="assigned" HeaderText="Assigned To" SortExpression="assigned" />
Line 30:                 <asp:BoundField DataField="customer" HeaderText="Customer" SortExpression="customer" />
Line 31:                 <asp:BoundField DataField="jobno" HeaderText="Job No" SortExpression="jobno" /><ItemStyle Width="100px" /></asp:BoundField>
Line 32:                 <asp:BoundField DataField="duedate" HeaderText="Due Date" SortExpression="duedate" DataFormatString="{0:d}" ><ItemStyle Width="100px" /></asp:BoundField>
Line 33:                 <asp:BoundField DataField="issue" HeaderText="Issue" SortExpression="issue" />

Source File: /portal2/issues.aspx    Line: 31

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237

This makes no sense. If I start using VS.net am I forced to use all the stupid little wizards and not hand code at all?
0
Comment
Question by:princeservice
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 40425950
did you recompile the code after that change?
at least that is the only thing I can see, as the code looks correct ...
0
 
LVL 34

Assisted Solution

by:Paul MacDonald
Paul MacDonald earned 1000 total points
ID: 40426175
Try this instead...

<asp:BoundField DataField="jobno" HeaderText="Job No" SortExpression="jobno" ItemStyle-Width="100px"/></asp:BoundField>
0
 

Author Comment

by:princeservice
ID: 40430485
I figured it out. I made the mistake of not removing the  / after SortExpression="jobno".
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question