My HTML Code is following.


<asp:GridView ID="grdOrderDetail" runat="server" AutoGenerateColumns="false" PageSize="50"
Width="755px" OnRowDataBound="FormatGrid" ShowHeader="true" AllowSorting="false"
CellPadding="0">


<Columns>
<asp:BoundField HeaderText="Order ID" DataField="OrderID">
<HeaderStyle BackColor="Silver" Width="20%" BorderStyle="Solid" HorizontalAlign="Left" />
<ItemStyle Width="20%" />
</asp:BoundField>
<asp:BoundField HeaderText="Product ID" DataField="ProductID">
<HeaderStyle BackColor="Silver" Width="20%" BorderStyle="Solid" HorizontalAlign="Left" />
<ItemStyle Width="20%" />
</asp:BoundField>
<asp:BoundField HeaderText="Unit Price" DataField="UnitPrice">
<HeaderStyle BackColor="Silver" Width="20%" BorderStyle="Solid" HorizontalAlign="Right" />
<ItemStyle Width="20%" HorizontalAlign="Right"/>
</asp:BoundField>
<asp:BoundField HeaderText="Quantity" DataField="Quantity">
<HeaderStyle BackColor="Silver" Width="20%" BorderStyle="Solid" HorizontalAlign="Right" />
<ItemStyle Width="20%" HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField HeaderText="Discount" DataField="Discount">
<HeaderStyle BackColor="Silver" Width="20%" BorderStyle="Solid" HorizontalAlign="Right" />
<ItemStyle Width="20%" HorizontalAlign="Right"/>
</asp:BoundField>
</Columns>


<HeaderStyle Font-Bold="False" ForeColor="Black" />
<RowStyle CssClass="GridRowContent" />
</asp:GridView>

I am getting the error

Compiler Error Message: CS1061: 'ASP.orderdetails2_aspx' does not contain a definition for 'FormatGrid' and no extension method 'FormatGrid' accepting a first argument of type 'ASP.orderdetails2_aspx' could be found (are you missing a using directive or an assembly reference?)

Please help me out.

Thanks in Advance.

You are missing a FormatGrid method in your code behind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.