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

Delete Parameter - Value cannot be null. Parameter name g.

1 Answer 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gullo
Top achievements
Rank 1
Gullo asked on 13 Feb 2012, 11:17 AM

Hi,

I have the following problem, in my RadGrid i have the operation update select and delete. Update and Select works fine. but the delete operation give me always the error that the parameter is null.

this is my grid

<telerik:RadGrid ID="radGrid1" AutoGenerateEditColumn="True" DataSourceID="objectDataSource1"
    runat="server" GridLines="None" Skin="Office2010Blue" AutoGenerateColumns="False">
    <MasterTableView AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" CommandItemDisplay="Top" DataSourceID="ObjectDataSource1">
        <CommandItemSettings ShowAddNewRecordButton="false" />
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                <ItemStyle CssClass="MyImageButton" />
            </telerik:GridEditCommandColumn>
            <telerik:GridDropDownColumn DataField="AddressType" DataSourceID="objectDataSource1"
                HeaderText="Category" ListTextField="AddressType" ListValueField="AddressType"
                UniqueName="AddressType">
            </telerik:GridDropDownColumn>
            <telerik:GridDropDownColumn DataField="CategoryType" DataSourceID="objectDataSource1"
                HeaderText="CategoryType" ListTextField="CategoryType" ListValueField="CategoryType"
                UniqueName="CategoryType">
            </telerik:GridDropDownColumn>
            <telerik:GridDateTimeColumn DataField="NotificationDate" HeaderText="NotificationDate"
                UniqueName="NotificationDate" />
            <telerik:GridCheckBoxColumn DataField="NoticeOfReceipt" UniqueName="NoticeOfReceipt"
                HeaderText="NoticeOfReceipt" />
            <telerik:GridBoundColumn DataField="id" HeaderText="id" SortExpression="id" UniqueName="id" />
            <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                UniqueName="DeleteColumn">
                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

 

and this is my datasource

<asp:ObjectDataSource ID="objectDataSource1" TypeName="ESTV.A3.Logic.AddressCaseRelationBll" SelectMethod="Select" UpdateMethod="Update" DeleteMethod="Delete"
    runat="server">
    <SelectParameters>
        <asp:QueryStringParameter Name="addressId" Type="String" Direction="Input" QueryStringField="id">
        </asp:QueryStringParameter>
    </SelectParameters>
    <UpdateParameters>
        <asp:Parameter Name="id" Type="String" Direction="Input" />
        <asp:Parameter Name="NotificationDate" Type="DateTime" />
        <asp:Parameter Name="NoticeOfReceipt" Type="Boolean" />
        <asp:Parameter Name="AddressType" Type="String" />
        <asp:Parameter Name="CategoryType" Type="String" />
    </UpdateParameters>
    <DeleteParameters>
        <asp:Parameter Name="id" Type="String"/>
    </DeleteParameters>
</asp:ObjectDataSource>

in my DAO i have for the delete method the following code

public void Delete(string id)
{
    Guid guidId = new Guid(id);
    AddressCaseRelation addressCaseRelation = entityDao.GetById(guidId);
    entityDao.Delete(addressCaseRelation);
    entityDao.CommitChanges();
}

Regards

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 16 Feb 2012, 03:26 PM
Hello Gullo,

Set the DataKeyNames property as shown below and let me know if the problem persists:
<MasterTableView DataKeyNames="quidId">

I also recommend that you examine the Deleting Records help topic.

Regards,
Pavlina
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
Gullo
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or