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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

124409 Jun 8,2016 01:28 AM Jun 9,2016 12:47 PM ASP.NET Web Forms 1
loading
Tags: Grid
kalum
Asked On June 8, 2016 01:28 AM

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.




Gowthami V [Syncfusion]
Replied On June 9, 2016 12:47 PM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;