We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to display selected text rather than the value of dropdownlist bound to Grid column.

I have a dropdownlist, which has bound to a grid. That dropdownlist has items like Item1, Item2, Item3 and their values are as 1,2,3 respectively

When I select the item text from the dropdownlist and move to the next row of the grid - the value of the selected text has been display in the grid rather than displaying the selected text.

I want to display the text in the dropdownlist column and the value has to be passed to another column in the same grid when selecting an item. Please help me to solve this issue.

Thank you.




1 Reply

GV Gowthami V Syncfusion Team June 9, 2016 04:47 PM UTC

Hi Kalum, 
 
Thanks for using Syncfusion products. 
 
Query 1: the value of the selected text has been display in the grid rather than displaying the selected text. 
 
We can achieve your requirement by set the dropdownlist’s selected text value to the args.value in CellSave event of the grid as follows, 
 
<ej:Grid ID="Grid" runat="server" AllowPaging="true"> 
. . . . 
. . . . 
  <ClientSideEvents CellSave="cellSave" /> 
        </ej:Grid> 
 
<script type="text/javascript"> 
 
        function cellSave(args) { 
            if (args.columnName == "EmployeeID") { 
                //The value has been passed to another column  
                window.dropValue = args.value; 
 
                //changing args.value as selectedText of dropdownlist 
                var dt = $("#MainContent_GridEmployeeID").data("ejDropDownList"); 
                args.value = dt.selectedTextValue; 
            } 
 
        } 
    </script> 

Query 2: the value has to be passed to another column in the same grid when selecting an item 
 
We can get the selected value of the dropdownlist using args.value property. In the above snippet we have saved the args.value in window.dropValue before saving the cell. 
 
We can pass this value while moving to the next column from current column. 
 
If we misunderstood your requirement please provide us below details about your requirement, 
 
1.    In which you need to pass the value to the other column? 
2.    Screenshot for the display of value and text in the grid. 
3.    Product version details. 
 
The provided information will help to analyze the issue and provide you the response as early as possible. 
 
For your convenience we have created a sample and the same can be downloaded from the following link, 
 
 
Regards, 
 
Gowthami V. 


Loader.
Live Chat Icon For mobile
Up arrow icon