Error Trying to Format GridView Template Controls
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.
Related Stories
POSTED IN: Software Errors, Visual Web Developer Express
4 opinions for Error Trying to Format GridView Template Controls
John Orth
Feb 5, 2008 at 12:10 pm
Not 100% sure, but I don’t think you can put directly inside an . I think you need to put some sort of template in between. Something like:
Jason Bean is a loser
John Orth
Feb 5, 2008 at 12:10 pm
So, apparently, I cannot put tags into your blog’s comments. :)
Error Invoking "Edit Fields…". - Solution Found?
Feb 5, 2008 at 12:32 pm
[…] working on another website project and I keep getting the error I wrote about before on “Error Invoking….” […]
Jason
Feb 5, 2008 at 1:02 pm
You’re right John. Most tags are not allowed in the comments field. I believe I finally solved my own problem though if you follow the comment link above. Wow! E-mail a friend for help and they call you a loser on your own blog. =)
Have an opinion? Leave a comment: