views:

334

answers:

1

Hi ,

It's my first use of DetailsView . I'm trying to use DetailsView and ObjectDataSource for Inserting/Editing records .

My ObjectDataSource invoke a method in BLL which parameter of that method is an Object .When I go through ObjectDataSource Configuration Wizard i choose appropriate method for CRUD . The ObjectDataSource is like follow , As you can see it doesn't create any parameter for Insert Method :

        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
            DataObjectTypeName="MD.Toos.BusinessEntities.Category"
            DeleteMethod="Delete" 
            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetItem" TypeName="MD.Toos.Bll.CategoryManager" 
            UpdateMethod="Update">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="id" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>

I have a method for update in Bll like follow which has an Object for parameter

  public static int Insert(Category ObjCategory)
    {
        ObjCategory.Id = CategoryDB.Insert(ObjCategory);
        return ObjCategory.Id;
    }

In DetailsView i have some BoundField which InsertVisible="False" so i want do some modification on them befor inserting . It's the place i don't know how to do that .

Please help me at this .

A: 

As you can see it doesn't create any parameter for Insert Method :

Yes that is because your Insert Method only provides your Category-Class as parameter. As far as I know, that is the default behaviour in this case.

so i want do some modification on them befor inserting

Have a look at the Inserting event of the ObjectDataSource.

citronas