none
Problem with setting insert with DetailsView mode RRS feed

  • Question

  •  

    I'm using the DetailsView for the first time and have the following:

     

     

    <!-- Form View -->

    <asp:DetailsView ID="DetailsViewCustomer"

    runat="server"

    DataKeyNames="CustomerId"

    DataSourceID="ObjectDataSourceCustomer">

    <Fields>

    <asp:BoundField DataField="CustomerId" HeaderText="CustomerId&nbsp;" InsertVisible="False" ReadOnly="True" ItemStyle-BackColor="Moccasin" ItemStyle-Font-Bold="True" />

    <asp:BoundField DataField="Name" HeaderText="Name&nbsp;" />

    <asp:BoundField DataField="Description" HeaderText="Description&nbsp;" />

    </Fields>

    <FooterTemplate>

    <asp:Button ID="ButtonSave" Runat="server" Text=" Save " onclick="ButtonSave_Click"></asp:Button>

    &nbsp;&nbsp;<asp:Button ID="ButtonCancel" Runat="server" Text="Cancel" onclick="ButtonCancel_Click"></asp:Button>

    </FooterTemplate>

    </asp:DetailsView>

     

    <!-- Object Data Source -->

    <asp:ObjectDataSource ID="ObjectDataSourceCustomer"

    runat="server"

    TypeName="BusinessLayer.Facade.CustomerFacade"

    SelectMethod="CustomerTemplate">

    <SelectParameters>

    <asp:QueryStringParameter Name="CustomerId" QueryStringField="id" />

    </SelectParameters>

    </asp:ObjectDataSource>

     

    On the initial load of the page I set the view mode to insert with

     

    DetailsViewCustomer.ChangeMode(DetailsViewMode.Insert);

     

    The problem is that, it tries to return the CustomerTemplate object from the CustomerFacade.  I'm stepping through and i'm positive the line above to change the view mode to insert is getting executed.  Why does it still try to process the select method?

    Friday, November 30, 2007 4:01 PM