Hi,
I have added an ultaoptionset to the editor component on my ultra grid
Me.tblAssetReg.DisplayLayout.Bands(0).Columns(4).EditorComponent = rbappdec
I want to set the value of the option set based on information in another column, normally I would use on initialize row but I can't work out how to set the value
Private Sub tblAssetReg_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles tblAssetReg.InitializeRow
If e.Row.Cells("Status").Value.ToString = "D" Then
e.Row.Cells("Dec/App") ("set the option index to 1" etc?)
End If
can anyone help please
hope this makes sense, I'm not too good at explaining things
Why can you not just use
e.Row.Cells("Dec/App").Value = yourValue
Hi David,
Thank you for coming back to me. my column "Dec/APP" has radio buttons approve and decline, the user has the option to change the selection so I need to set the radio buttons based on the last saved information. So if the value in status is D then I need my second option button selected, if it's A I need my first option selected.
What you are suggesting is what I want to do, I don't know how to set the option button to the correct one.
All you have to do is set the Value of the cell to a value that matches the DataValue of one of the items in the OptionSet. When you set up your OptionSet, you added two items. Those items are ValueListItem objects and each one has a DataValue and a DisplayText. The "selected" option in the OptionSet will depend on the Value of the cell. The Value will be the DataValue of one of the ValueListItems in the OptionSet.
You should also make sure the DataTypes match. For example, your OptionSet has two options. What did you use for the DataValues? True/false? 0/1?
If you used true/false, then you need to make sure the DataType of the grid column is a Boolean so it matches those values. Likewise, if you use 0/1, the column's DataType needs to be an int.
Oh my word, now I do feel like an idiot. It works perfectly.
Thanks so much
One thing I noticed immediately is that your DataTypes are not the same.
In your screen shot the DataValue of the item is "O", but the indicator before it says "chr" which is a char, not a string. And then in the code you are using "O" which is a string, not a char. So those are not going to match.
"O"(string) does not equal 'O' (char) in DotNet.
I can't see from this what the DataType of the Column is, but it's presumably string, also. So you need to pick one and be consistent.
If that still doesn't work, please post a small sample project here and I will be happy to take a look and see why it's not working.
Hi Mike
Thank you for your reply, it all sounds so easy and I feel like a idiot but I still cannot get it correct, I have attached a file with screenshots. The data in column Status and column App/Dec are the same, they both have the value "O" in. I put code into the initialize row to see if the value is correct, it goes in to the if condition and it should set the option button to approved.
Can you see from what I have sent you where I am going wrong. Please let me know if the attachment is not clear
Regards