How to put conditional C# on Switch component to modify hidden data-bound field

My Radzen app is bound to an Oracle data source, which doesn't have a SQL boolean data type (exists in PL/SQL, but not in Oracle SQL tables). I want to use a Switch component in my CRUD page, that fires on a change event to set a hidden, data-bound textbox to either 'y' or 'n'. Can you point me to an example of the code I need to write for this?

I'm stuck here:

If the Switch is in the same form you can set directly the object property:
myObj.MyProperty = args ? “y” : “n”

What am I missing? There is a textbox called "OwnerSharedTextBox." It's bound to the data source and it's the one I'm trying to change with the switch component's change event.

As I said in my previous reply you can set directly the object property - not the TextBox Value. What is the expression in the TextBox.Value? There is also far more simple way to deal with such scenarios - extend your model with additional not mapped property that will get/set the origin property base on your own custom logic.

Thanks for your help and your time, @enchev

What do you mean by the object property? The object has several properties, so I just though the .value property was the one I was supposed to set.

If there's a better, simpler way to handle this, I want to learn it.

Coming from a SQL background rather than a C# background, implementing two partial, custom classes to extend the model does not seem simple. I've read through the link you shared, and I'm trying to wrap my head around how an extended property can ultimately be made to set the single char field in the database for Owner_Shared. Seems easier to me to just take care of it inside the Change event of the switch, but again, I want to learn best practices.

I've created a partial custom class for an extended property I could bind to the switch component

public partial class QbSet
  public Boolean OwnerSharedTrueFalse

now if I understand correctly, I also need to create a partial custom class for the xxxServices.cs that handles events? and somehow make that xxxServices.Custom.cs code set the original database Owner_Shared field to "n" when the switch is off?

OK I got this to work. I realized I didn't need a hidden field after all.

The switch component is not bound directly to the data set, but in its Change event I use the "event" keyword to grab the switch's args (boolean true or false) and then set the data set's OWNER_SHARED single char value based on it. See code in screenshot:

So, based on the switch's on or off status, it sets the OWNER_SHARED field to either "y" or "n". However, an additional requirement is that during the page load event, we need to set the OWNER_SHARED to be "n" by default, so that if the user never flips the switch, it will be written as "n" to the database.

I'm still interested in learning about extending models with NotMapped properties, but for my issue, this seems to work.