Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

set dropdown list text property

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
kinetico



Joined: 31 Aug 2007
Posts: 7

PostPosted: Fri Sep 21, 2007 8:55 pm    Post subject: set dropdown list text property Reply with quote

Hi,

I have a problem when the dropdownlist editor is displayed in the cell. It always shows the first list item. When I move off to another cell the cell.value gets replaced by the list item.
I thought I can handle it in the Editor_SetControlValue by prepopulating the dropdown list with the cell.value. Following is my code:
*****************
Private Sub UnitEditor_SetControlValue(ByVal sender As Object, ByVal e As Infralution.Controls.VirtualTree.CellEditorSetValueEventArgs) Handles UnitEditor.SetControlValue
Dim dropDownList As Infralution.Controls.VirtualDropDownList = TryCast(e.Control, Infralution.Controls.VirtualDropDownList)
Dim UnitList As List(Of AttributeUnit) = TryCast(dropDownList.DataSource, List(Of AttributeUnit))
_unitSearchValue = New AttributeUnit("", e.Value.ToString)
Dim FoundUnit As AttributeUnit = UnitList.Find(AddressOf FindUnitListItem)

UnitDropDownList.SelectedItem = FoundUnit
End Sub


Private Function FindUnitListItem(ByVal value As AttributeUnit) As Boolean
If _unitSearchValue.Description = value.Description Then
Return True
Else
Return False
End If
End Function

********************

However, changing the dropdowlist.selecteditem doesn't change the text displayed.


Please help!!!

Thanks in advance

Milena Voronkin
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Sep 23, 2007 10:51 pm    Post subject: Reply with quote

If you bound the Unit column to the Unit object (not to the Unit.Description) object then you should just be able to set the CellEditor for the column and it will all work automatically. For a VirtualDropDownList you have to set the CellEditor.ValueProperty to "SelectedItem".

You should, however, also be able to do it the way you are attempting. Did you paste this code from your project? Because that would probably explain why it's not working. The line:

Code:
UnitDropDownList.SelectedItem = FoundUnit


Should be:

Code:
dropDownList .SelectedItem = FoundUnit


I suspect UnitDropDownList is the member variable for your template editor control - not the control you are trying to set the value for. Not that if you hande the SetControlValue event you will probably also have to handle the GetControlValue event to handle getting the value back out of the control.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group