Clear selected value in UltraOptionSet - winforms

I have an UltraOptionSet control that is unbound. Once a value has been selected, how can I clear the selected value? I want the net effect of all options in the UltraOptionSet control to be unselected.
I tried setting the Value property to null and DBNull.Value but neither cleared the selected option.

Just set
optionSet.CheckedIndex = -1;
this will clear the current checked item and nothing else will be set.

Set the Value to Null rather than DBNull.Value and it will clear the selection. You can also set the value to an empty string.
There are a few other ways as well and I believe this is all of the possible ways to clear the value for an unbound UltraOptionSet:
this.ultraOptionSet1.Value = null;
this.ultraOptionSet1.Value = "";
this.ultraOptionSet1.CheckedIndex = -1;
this.ultraOptionSet1.CheckedItem = null;
this.ultraOptionSet1.ResetCheckedIndex();

Related

Transforming null into array.length = 0

Probably a noob Question: On my server, there is a filter which returns all available options if an array of the filter object has length.0 for certain options.
Now if say i have an input "All Options" from the user side, this option when clicked must somehow tell the array to have length.0, so the server returns all options .
I tried to set the Input to
<mat-option [value]= null >Alle</mat-option>
But that results in an array that has the value null instead of no length at all.
I also tried
If (data.array[1] == undefined){
data.array.length == 0
}
But that did not work
Leave the value to null and then do it like this:
if (!data.array) {
data.array = [];
}

How to set combo-box as default

How to clear a combo-box selected values when clicking on a 'Clear' button? When the time of clicking clear button, it needs to set it as default.
I wrote it as;
DO:
ASSIGN
coCombo-2:SCREEN-VALUE IN FRAME {&FRAME-NAME} = "".
coCombo-3:SCREEN-VALUE IN FRAME {&FRAME-NAME} = "".
END.
"But this is not working."
You need to assign a space instead of an empty string
DO:
ASSIGN
coCombo-2:SCREEN-VALUE IN FRAME {&FRAME-NAME} = " ".
coCombo-3:SCREEN-VALUE IN FRAME {&FRAME-NAME} = " ".
END.
see also https://knowledgebase.progress.com/articles/Article/P21248

Store unchecked checkbox data

I cant seem to figure out how to store unchecked checboxes value in my DB.
i have this in my view
{{Form::label('user_photo', 'Valodas',['class' => 'control-label'])}}
Latviešu {{Form::checkbox('val[]', 'Latviesu',false)}}
Angļu {{Form::checkbox('val[]', 'Anglu',false)}}
Krievu {{Form::checkbox('val[]', 'Krievu',false)}}
And here is my controller function to store data
if($req->input('val') == null){
$valoda = "";
} else {
$valoda = request('val');
}
And in my database im only getting the value of the values that are checked
I need the 3rd value so that in my update view i could set values to checked or unchecked for each value
If you have a column for each checkbox, you can do it this way;
$latviesu = array_has($req->val,'Latviesu')?1:0;
$anglu = array_has($req->val,'Anglu')?1:0;
$krievu = array_has($req->val,'Krievu')?1:0;
checking that the array from the request has the value
But to be honest, I would rename the checkboxes so that they are not in an array
Quick reminder in Laravel 5.6 You can check if checkbox is checked by
$request->has('yourCheckboxName'); / return true / false

how to insert an item in Combobox(dropdown) with value in winforms

This is a silly question.
but I searched a lot in Google but not found any good solution for this.
If we write
ddlReleaseMngr.Items.Insert(0, "Naibedya Kar");
This will insert a item in the dropdown but the value of the item is ZERO.
I want to inset an item in the dropdown with some value.
if I do
ddlBA.DataSource = tblBA;
ddlBA.DisplayMember = "Name";
ddlBA.ValueMember = "UserID";
by using above query we can set value to each item.
Like this I want to set a value for item.
Please help me
Thanks in advance
The value of the item is not ZERO. The index is 0.
You can get the VALUE of the checkbox item by using:
ddlReleaseMngr.SelectedItem.ToString();
Which would give you "Naibedya Kar".
You can create an integer variable and assign it a value using the selected item like so:
int myvar = 0;
if(ddlReleaseMngr.SelectedIndex == 0)
{
myvar = 5; //or whatever value you would like
}
or use a switch statement:
switch (ddlReleaseMngr.SelectedIndex)
{
case 0:
Console.WriteLine("Case 1: " + ddlReleaseMngr.SelectedItem.ToString());
myvar = 0;//whatever value you would like
break;
case 1:
Console.WriteLine("Case 2");
break;
default:
Console.WriteLine("Default case");
break;
}
Why not Items.Add instead of Items.Insert like:
ddlReleaseMngr.Items.Add("Naibedya Kar");

How to set nested record using "set()"?

I'm facing problem in setting my record value.
I have nested record inside store like this :
- data
act_reading // I can set value of this record using -> record.set('act_reading', 'dsds');
adj_reading
act_reading_nested
- data
arr_act_colour // How can I set this record?
arr_act_rating // How can I set this record?
arr_act_ferrous // How can I set this record?
idrectype1 // How can I set this record?
adj_reading_nested
- data
arr_adj_colour
arr_adj_rating
arr_adj_ferrous
idrectype2
How can I set idrectype1 value inside act_reading_nested?
I also have to do the same thing for arr_act_colour, arr_act_rating, & arr_act_ferrous.
Thanks in Advance
Assuming record is variable holding reference to your recrd, wouldn't that work?
record.get('act_reading_nested').set('arr_act_colour','value');
record.get('act_reading_nested').idrectype1 = 'something';
Yes it would. Just checked.
From my experience with current implementation of the Store you can not :( I'm facing with such kind issue too, when I'd like to edit a non-plain Store in the GridPanel. see http://www.sencha.com/forum/showthread.php?119573-Event-beforeedit-in-EditableGridPanel&highlight=afteredit
I did not check it myself (rather found a hack workaround), but more clean way is to fix it with your own Store implementation using of Ext.override(Ext.Store, { ...}) facility.
See how I did it for 'standard' HttpProxy implementation.
Ext.override (Ext.data.HttpProxy, {
buildUrl : function (action, record) {
var ret = '';
if (window.location.pathname != '/') {
ret = window.location.pathname;
};
return ret + Ext.data.HttpProxy.superclass.buildUrl.call(this, action, record);
}
});
It requires a bit deep Extjs internal knowledge though.

Resources