Updating a Stored Procedure parameter

Hey Guys,

I've got a datagrid attached to my stored procedure, and the datagrid has a dropdown filter template. All of the relationships are in the SP, so the dropdowns only provide lookup values.

The dropdown's data value is set to ${spPropertyIDFKResult} and the dropdown's value is set to ${paProperityResult}. I'm thinking the value selected from the dropdown will populate ${paProperityResult} which in turn will also update the pPropertyIDFK parameter.

The datagrid works, the dropdown works, but the selecting an item from the dropdown doesn't update the parameter. I put an await this.Load() change event on the dropdown which does requery as required (await grid0.Reload() isn't sufficient as I want the SQL Server to filter, not Radzen), but the query's parameter's are not updated.

Ideally, the dropdown directly accessing and updating the pPropertyIDFK parameter directly without needing ${paProperityResult} would be nice.

I'm thinking I'm real close, can you give me a hint?

Thanks much!

The dropdown probably updates the value however this won't execute the stored procedure. You need to handle the Change event of the DropDown and invoke the stored procedure there as well and set the property which the DataGrid is bound to (SPEquipmentResult).

That is exactly what I said and am doing.

How is your dropdown declared? What is ${spPropertyIDFKResult}? What happens when you debug your code with Visual Studio - what is the value of the paPropertyResult property? Did you try putting a breakpoint in the code which executes the stored procedure (in the service that Radzen generated)?

Last but not least. Calling the Load method of the page manually isn't exactly best practice. It will execute everything in the Load event which may not be intended and reset other page properties. Just invoke the stored procedure in the Change event and set the property to which the DataGrid is bound to.

Thanks @korchev, you're right on. this.Load() reloads everything and reinitializes the param before the SP runs.

Will try what you describe,

@korchev having trouble invoking the stored procedure again from the change property. I can invoke it, but setting it to the same variable is problematic, because the ${result} value isn't available a 2nd time, as it was already used. If I manually enter ${result}, the property type isn't automatically recognized and stays dynamic.

I can set it to the same value:

but that results in this, which doesn't work. " protected async System.Threading.Tasks.Task DropdownDatagrid0Change(dynamic args)
var itInventoryDataGetSpEquipmentsResult = await ItInventoryData.GetSpEquipments(null, null, null, null, null, null, paProperityResult, blah blah blah);
SPEquipmentResults = SPEquipmentResults;

It seems I can force it to use ${result} if I manually change the property type to IEnumerable<ItInventory.Models.ItInventoryData.SpEquipment> instead of letting it automatically change to dynamic.

This actually works, but is it okay to do?

You should use ${result} to get the result of any operation invoked via Invoke data source method actions. It is ok to type the type of the property manually.

1 Like