Click here to Skip to main content
15,917,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Could anyone tell a way to add listItems in GridViewDataComboBoxColumn? & on selection changed, I want to have the selected item.

Actually in GridView I have one of the coloumn as GridViewDataComboBoxColumn.


XML
<dx:GridViewDataComboBoxColumn   Caption="SelectStatus"  FieldName="SelectStatus" VisibleIndex="2">
                  <PropertiesComboBox DropDownStyle="DropDownList"  TextField="SelectStatus" ValueField="SelectStatus">
                   <Items>
                       <dx:ListEditItem Text="On" Value="On" />
                       <dx:ListEditItem Text="Off" Value="Off" />

                   </Items>
                   </PropertiesComboBox>
               </dx:GridViewDataComboBoxColumn>

Even though I used DropDownStyle="DropDownList", the list is not displayed. After displaying the list I want to know the selected Item.
Posted
Updated 28-Nov-13 19:00pm
v2
Comments
Karthik_Mahalingam 27-Nov-13 4:06am    
not clear , Please add more info to your question...
sunpop 29-Nov-13 1:01am    
I've added code. Pl, check

1 solution

VB
Public Shared Function selectedTextValuefromGridViewDataComboBoxColumn(ByVal sender As Object, ByVal fieldName As String, ByVal val As Object) As String

        Dim column As GridViewDataComboBoxColumn = DirectCast(TryCast(sender, ASPxGridView).Columns(fieldName), GridViewDataComboBoxColumn)

        Dim item As DevExpress.Web.ASPxEditors.ListEditItem = column.PropertiesComboBox.Items.FindByValue(val)

        Dim valueTextCB As String = ""

        If item IsNot Nothing Then

            valueTextCB = item.Text

        End If

        Return valueTextCB

    End Function
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900