RadioButtonGroup with no default value


Author
Message
fansanitis
fansanitis
StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)
Group: Forum Members
Posts: 45, Visits: 103
I've setup a RadioButtonGroup with 5 options (values 0-4) on a user control.  The designer sets the Checked property of the option with the value of 0 to True.  I manually change the property back to False and save the file.  Everythings looks fine at this point, no options with a Checked property of True.  I close the user control designer in VS and then reopen it and the option with the value of 0 is "checked" again.

I want the user control to render with no option selected and if the BO is saved without the user making a selection I want a required field broken rule to be displayed.  Can I make the RadioButtonGroup do this?

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Can I make the RadioButtonGroup do this?

You are fighting .NET serialization and so this value is being updated and set in the InitializeComponent method...the answer is, "Yes."  but you may, in this instance, just need to set this in the constructor or the load instead of fighting the .NET designer.

fansanitis
fansanitis
StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)
Group: Forum Members
Posts: 45, Visits: 103
Thanks Trent that works great but now I'm being tripped up by my BO the control is bound to.  The field in the database is a smallint that allows nulls.  When I configure the BO in the BO Mapper I customize the field to use a Null Type of Use Nullable Generic which is 0 for this datatype.  So when I perform a BO.Add the BO property for the field in question gets set to 0 which is the value of one of my options so it always displays with an option selected.

How should I setup the database field and BO Mapping so no option is selected on a BO.Add?  I need to use the values 0-4 for the option values since they are later used in summary calculations.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just return an alternate value on NULL and set it to a -1 or something like that.  This way you do not have a collision of values and NULL.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search