b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

Microsoft Weblog

Error Trying to Format GridView Template Controls

by Jason Bean on February 1st, 2008

vwde-2008-error

Working on a client web application and I keep getting errors when I try to format fields and controls that are located in a GridView control. I’ve never had this problem before that I can think of when I was using Visual Web Developer 2005. Now I’m using Visual Web Developer 2008.

It’s a pain in the butt to fix it once it breaks because I’ve got to go into the code and hand-delete all the related span tags and formatting tags.

Is it as simple as needing to import controls into the VB of the page?

Here are the errors I’m getting that are all related to when I try to use the included formatting functionality of the GridView controls.

GridView - gvRet2Bid
There was an error rendering the control
Type ‘System.Web.UI.WebControls.CommandField’ does not have a public property named ’span’.

and

Error Creating Panel : Type ‘System.Web.UI.WebControls.CommandField’ does not have a public property named ’span’.

and

Error invoking ‘Edit Columns…’. Details:
Exception has been thrown by the target of an invocation.

Is there something wrong with the way VWDE08 is writing the code? Is it something I can control? Here’s the snippet of code that’s giving me the error:

   1: <asp:GridView ID=”gvRet2Bid” runat=”server” AutoGenerateColumns=”False” 
   2:                                             BorderColor=”Black” BorderStyle=”Dashed” BorderWidth=”2px” 
   3:                                             DataKeyNames=”BidProjectID” DataSourceID=”sqlSelProjDtls” GridLines=”None” 
   4:                                             HorizontalAlign=”Left” PageSize=”1″ ShowHeader=”False” CellPadding=”0″ 
   5:                                             CellSpacing=”3″ Width=”100%”>
   6:                                             <rowstyle backcolor=”Linen” font-bold=”True” font-size=”14pt” />
   7:                                             <Columns>
   8:                                                 <asp:commandfield ButtonType=”Button” SelectText=”Go To Bid” 
   9:                                                     ShowSelectButton=”True”>
  10:         <span style=”font-family: Arial”>
  11:                         <strong><span>
  12:                                                 <itemstyle width=”100px” wrap=”False”>
  13:                         </span></strong>
  14:                                                 </span></itemstyle>
  15:                                                 </asp:commandfield>
  16:                                                 <asp:boundfield DataField=”BidProjectVptJobNbr” HeaderText=”BidProjectVptJobNbr” SortExpression=”BidProjectVptJobNbr” Visible=”False”></asp:boundfield>
  17:                                                 <asp:boundfield DataField=”BidProjectNm” HeaderText=”BidProjectNm” 
  18:                                                     SortExpression=”BidProjectNm”></asp:boundfield>
  19:                                                 <asp:boundfield DataField=”BidProjectCity” HeaderText=”BidProjectCity” 
  20:                                                     SortExpression=”BidProjectCity” Visible=”False”></asp:boundfield>
  21:                                                 <asp:boundfield DataField=”BidProjectState” HeaderText=”BidProjectState” 
  22:                                                     SortExpression=”BidProjectState” Visible=”False”></asp:boundfield>
  23:                                             </Columns>
  24:                                         </asp:GridView>

Anyone else experienced or is experiencing this now with a project? I’m really in need of a solution to wrap some things up on this one.

POSTED IN: Software Errors, Visual Web Developer Express

4 opinions for Error Trying to Format GridView Template Controls

Have an opinion? Leave a comment: