Button Click Event

Hi Guys, I've stalled out on getting a button to update the Status, StatusID of a Table. ex( add a button to the opportunities table that changes the Status of an opportunity from Active to Won as well as select multiple rows in the table and have the click event update all the selected rows from Active to Won.). I am able to filter the Table but not change the value in the database.

Thanks

Can you show us your code saving the updated values to the database?

Here is the Current version.

Thanks

I see that you’ve set a Page property chgStatus however it is not clear if this property value is submitted to the server and where. Also updatePurchaseOrder method should have one more parameter for the order most probably.

Can you give me an example of the code you need to get this done. I'm not getting much out of the documentation for this scenario.

Thanks

Radzen generates updateXXX method for every table with two parameters - primary key and object instance with values. Here is an example with Form submit where the object instance with updated values is retrieved from event object

this is call the server method which will perform the database update:

[HttpPatch("{Id}")]
[EnableQuery(MaxExpansionDepth=10,MaxNodeCount=1000)]
public IActionResult PatchOrder(int key, [FromBody]Delta<Models.Sample.Order> patch)
{
    try
    {
        if(!ModelState.IsValid)
        {
            return BadRequest(ModelState);
        }

        var item = this.context.Orders.Where(i => i.Id == key).FirstOrDefault();

        if (item == null)
        {
            return BadRequest();
        }

        patch.Patch(item);

        this.OnOrderUpdated(item);
        this.context.Orders.Update(item);
        this.context.SaveChanges();

        var itemToReturn = this.context.Orders.Where(i => i.Id == key);
        return new ObjectResult(SingleResult.Create(itemToReturn));
    }
    catch(Exception ex)
    {
        ModelState.AddModelError("", ex.Message);
        return BadRequest(ModelState);
    }
}

So to update your database record with new values you need to execute updateXXX method and provide both parameters.

I don't see where the new Id number is in your example that is getting updated in the database, this looks like half of the steps

Thanks

It is in the first screenshot.