This is a migrated thread and some comments may be shown as answers.

RadGrid and SubSonic

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Kingston
Top achievements
Rank 2
David Kingston asked on 30 Sep 2008, 06:39 PM
I'm new to the Rad Toolset and I'm trying to figure some things out.  I've done a lot of google and reading on the forums and can't find what I'm looking for.

My setup is as follows:  The DAL was created by SubSonic.  I've created an ObjectDataSource and have a RadGrid hooked up to that.  The ObjectDataSource points to the controller source generated by SubSonic for that table.  In this instance I'm doing two identical lookup tables for facilities and divisions.  I'm trying to create a radgrid with the edit, insert,  and delete functions.

Two problems:
1.  The insert and edit functions work great on the division table, but not the facilities table.  I've checked the source and the two pages are identical.  An update on the facilites page results in an error message:

ObjectDataSource could not find a non-generic method 'Update' that has parameters:  FacilityName, FacilityDescription, FacilityID, original_FacilityID.

That is true.  The signature doesn't include the original_FacilityID.  But the update for the Division table doesn't include the original_DivisionID in it either, and it works fine.  I can't figure out where this parameter comes from as it's not in any list in the page:

        <telerik:GridBoundColumn DataField="DivisionID"
            HeaderText="DivisionID" SortExpression="DivisionID"
            UniqueName="DivisionID" DataType="System.Int32" Visible="False">
        </telerik:GridBoundColumn>

        <telerik:GridBoundColumn DataField="FacilityID" DataType="System.Int32"
            HeaderText="FacilityID" SortExpression="FacilityID"
            UniqueName="FacilityID" Visible="False">
        </telerik:GridBoundColumn>

And the DataSource contains the same definitions:

    <asp:ObjectDataSource ID="CmdbDivision" runat="server" DeleteMethod="Delete"
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"
        SelectMethod="FetchAll" TypeName="CMDB.TblDivisionController"
        UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="DivisionID" Type="Object" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="DivisionID" Type="Int32" />
            <asp:Parameter Name="DivisionName" Type="String" />
            <asp:Parameter Name="DivisionDescription" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="DivisionName" Type="String" />
            <asp:Parameter Name="DivisionDescription" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
        DeleteMethod="Delete"
        InsertMethod="Insert"
        OldValuesParameterFormatString="original_{0}"
        SelectMethod="FetchAll"
        TypeName="CMDB.TblFacilityController"
        UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="FacilityID" Type="Object" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="FacilityID" Type="Int32" />
            <asp:Parameter Name="FacilityName" Type="String" />
            <asp:Parameter Name="FacilityDescription" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="FacilityName" Type="String" />
            <asp:Parameter Name="FacilityDescription" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>

I believe the second problem to be related, as the delete function works on neither page.  The facility page fails because of the same signature problem, whereas the division page just refreshes and doesn't do the delete.

Any suggestions?  I'm hoping that someone here has some SubSonic with Rad Grid experience and can help me.  If not, maybe you're familiar with ways to work around this problem with the original_ID problem.

3 Answers, 1 is accepted

Sort by
0
David Kingston
Top achievements
Rank 2
answered on 30 Sep 2008, 08:23 PM
Removing this parameter has solved my problems.

OldValuesParameterFormatString="original_{0}"

For the record you can hook up a RadGrid to SubSonic's Controller without much problem using a ObjectDataSource.
0
David Kingston
Top achievements
Rank 2
answered on 30 Sep 2008, 08:43 PM
Also you have to make sure that DataKeyNames in the MasterTableView has the correct ID.  The division lookup was failing because the ID was defined wrong.  Eliminating the ID makes the grid refresh but no delete.

Mine looks like this:
DataKeyNames="DivisionID"
0
David Kingston
Top achievements
Rank 2
answered on 01 Oct 2008, 06:47 PM
FYI -- Everytime you re-run the ObjectDataSource wizard to configure it, it will re-add the OldValuesParameterFormatString="original_{0}" parameter back to the list, breaking your app again.  Not exactly agile.
Tags
Grid
Asked by
David Kingston
Top achievements
Rank 2
Answers by
David Kingston
Top achievements
Rank 2
Share this question
or