Question

I have a Grid View which works, the data bound columns extract the proper information but when I try to add a Template Field I get the following error in the browser:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

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

The Grid View I declared it as such:

     <asp:View ID="Foo" runat="server">
                <asp:GridView ID="Foo" runat="server" DataKeyNames="id"
                    DataSourceID="odsFoo" Width="631px" OnRowDataBound="gwFoo_RowDataBound"
                    CssClass="customerDataTable" AllowSorting="True" 
                    onselectedindexchanged="gwOrderInvQuote_SelectedIndexChanged">
                    <Columns>

The Template Field I declared it as such:

 <asp:TemplateField AccessibleHeaderText="fhfj">
            <HeaderTemplate> This is a Test </HeaderTemplate>
            <ItemTemplate> </ItemTemplate>
 </asp:TemplateField>

The effect I'm trying to achieve is to line up a button perfectly with the grid, my strategy thus far is to create this templated field and insert the in the header leaving all the other cells empty, the column has no other purpose but to house the button so that it is aligned with the grid.

The problem being that this is the first time I'm working with a grid view and the templated field and even this simple test to see if I can create a empty column doesn't work.

Was it helpful?

Solution

You have to define method gwOrderInvQuote_SelectedIndexChanged in your cs file:

 protected void gwOrderInvQuote_SelectedIndexChanged(object sender, EventArgs e)
 {
 // insert logic here
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top