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

ObjectDataSource 'ods1' could not find a non-generic method 'UpdateSensorBulkSettings' that has parameters: all my parameters + original_ID.

1 Answer 358 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Magnus
Top achievements
Rank 2
Magnus asked on 10 Mar 2017, 06:34 AM

Hi guys,

Question: Do I have to move my objectdatasource settings for code behind to codebehind in this scenario? If I have to how do I do it?
and in what event? I have been dabbling with this for 2 days now.

I have a Radgrid using the batch editing features of this demo:

http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

But I have added with some cascading comboboxes to apply some pre-filtering for the entire radgrid. I have an objectdatasource connected to it but since I added the cascading comboboxes to my page. Can I still make the updates defined in my objectdatasource in the ASPX page as I had to move my selectmethods for the grid to codebehind?

On page_load I have the following code 

 if (RadComboBox1.SelectedValue != "" && RadComboBox2.SelectedValue != "" && RadComboBox3.SelectedValue != "")
        {
            Literal1.Text = string.Format(MessageTemplate, RadComboBox3.Text, RadComboBox2.Text, RadComboBox1.Text);
            Lower = RadComboBox2.Text;
            Higher = RadComboBox3.Text;
            GetCompared(Lower, Higher);
        }
        else
        {
            ods1.SelectMethod = "GetSensorBulkData";
        }

if the boxes are all selected I call GetCompared function

 protected void GetCompared(string Lower, string Higher)
    {
        NotifyUser("Är " + Lower + " lägre än " + Higher);
        ods1.TypeName = "DAL";
        ods1.SelectParameters.Clear();
        ods1.SelectParameters.Add("Low", TypeCode.String, Lower);
        ods1.SelectParameters.Add("High", TypeCode.String, Higher);
        ods1.SelectMethod = "GetSensorBulkDataCompared";

    }

I can also call the GetCompared from button click 

protected void Button1_Click(object sender, EventArgs e)
    {
        Literal1.Text = string.Empty;

        if (RadComboBox1.SelectedValue != "" && RadComboBox2.SelectedValue != "" && RadComboBox3.SelectedValue != "")
        {
            Literal1.Text = string.Format(MessageTemplate, RadComboBox3.Text, RadComboBox2.Text, RadComboBox1.Text);

            Lower = RadComboBox2.Text;
            Higher = RadComboBox3.Text;

            GetCompared(Lower, Higher);
        }

This pre filtering I have here is to compare different sites data to see if we have any deviations. and then Adjust settings accordingly if we need to make overrides.

I would prefer if I could tell my objectdatasource to use this update from the ASPX page but for some reasone I get the error 

ObjectDataSource 'ods1' could not find a non-generic method 'UpdateSensorBulkSettings' that has parameters: "all my parameters" + original_ID.

btw I added original_id to the updateparameters and trap it in my dataaccess layer as I didnt think I need it.

<asp:ObjectDataSource ID="ods1" TypeName="DAL" OldValuesParameterFormatString="original_{0}" UpdateMethod="UpdateSensorBulkSettings" runat="server">
        <UpdateParameters>
            <asp:Parameter Name="Id" Type="Int32" />
            <asp:Parameter Name="Site1Main1" Type="Double" />
            <asp:Parameter Name="Site1Main2" Type="Double" />
            <asp:Parameter Name="Site1Main3" Type="Double" />
            <asp:Parameter Name="Enabled" Type="Boolean" />
           <asp:Parameter Name="Site2Main1" Type="Double" />
           <asp:Parameter Name="MatchSite1Main1Settings" Type="Boolean" />
           <asp:Parameter Name="Site2Main2" Type="Double" />
           <asp:Parameter Name="MatchSite1Main2Settings" Type="Boolean" />
           <asp:Parameter Name="Site2Main3" Type="Double" />
           <asp:Parameter Name="MatchSite1Main3Settings" Type="Boolean" />

            <asp:Parameter Name="......other parameters...." Type="Double" />
            <asp:Parameter Name="Username" Type="String" />
            <asp:Parameter Name="original_ID" Type="Int32" />
        </UpdateParameters>
    </asp:ObjectDataSource>

Could anyone please help with this I'm staring myself blind and need some advice here.

I have posted some previous questions relating to this but as I got not answers on the previous post and I managed to fix all but this Issue.

1 Answer, 1 is accepted

Sort by
0
Magnus
Top achievements
Rank 2
answered on 10 Mar 2017, 06:36 AM
A secondary question or can I get the Selectmethod back to objectdatasource in the ASPX page and use some Parameters for the SELECT statement and if so how do I do that?
Tags
Grid
Asked by
Magnus
Top achievements
Rank 2
Answers by
Magnus
Top achievements
Rank 2
Share this question
or