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.

grid dropdown not returning value only text

Thread ID:

Created:

Updated:

Platform:

Replies:

107590 Mar 7,2013 06:30 PM Apr 3,2014 03:38 AM ASP.NET MVC (Classic) 11
loading
Tags: Grid
peter foley
Asked On March 7, 2013 06:30 PM

The HTML generated from the dropdown in a grid is not using the value field only the text field. When the record gets saved no id value is returned.
 
Controller
List<dropdown> dataf = new List<dropdown>();
foreach (Fleet f in db.Fleets.ToList())
{
   dropdown fleet = new dropdown();
   fleet.id = f.FleetID;
   fleet.name = f.FleetName;
   dataf.Add(fleet);
}
ViewData["FleetsDropDownSource"] = dataf;
 
View
 Html.Syncfusion().Grid<FleetPlanner.Models.Asset>("AssetGrid")
      .Datasource(Model)
      .EnablePaging()
      .EnableSorting()
      .Caption("Assets")
      .Column( column => {
          column.Add(p => p.AssetID).HeaderText("ID").Visible(false);
          column.Add(p => p.AssetName).HeaderText("Asset Name");
          column.Add(p => p.Fleet.FleetName).HeaderText("Fleet Name").CellEditType(CellEditType.DropdownEdit).DropDownDataSource((System.Collections.IEnumerable)ViewData["FleetsDropDownSource"],"name","id");
      })
 
Generated HTML for DropDown
<option value="C130">C130</option>
<option value="Centurion">Centurion</option>
<option selected="selected" value="FA18">FA18</option>
 

Bala Murugan A.S [Syncfusion]
Replied On March 7, 2013 11:44 PM

Hi Peter,

We regret for the inconvenience caused. We are unable to reproduce your reported issue in our end. The selected value of the dropdownlist only gets saved in the database. Please refer the below screenshot.

[screenshot]

DropDownDS.zip

Could you provide a simple sample which will replicate your issue so that we could able to sort out the cause of this issue and provide you a better solution quickly?.

Please let us know if you have any concerns.

Regards,

Bala Murugan A.S


peter foley
Replied On March 11, 2013 05:59 PM

What I want i to return is the key field value not the text field. In your example of countries these are the same! So for example if the drop down list is based on a country code & name structure (1, "USA", 2, "AUS", etc) I want it to show USA, AUS etc and return the selected code value 1 or 2 etc

Maithiliy K [Syncfusion]
Replied On March 14, 2013 06:04 AM

Hi Peter,

Thanks for using Syncfusion product.

Based on your requirement, we have created a simple sample in both Server and JSON mode by binding the “Text” and “Value” field for the dropdown edit column.

We are afraid that we are unable to reproduce the issue reported by you. Can you please attach the sample in this forum or modify our sample , so that we could sort out the cause of the issue and provide you a solution.

Sample Link : http://www.syncfusion.com/downloads/Support/DirectTrac/105400/DropDown195451240.zip

 

Please let us know if you would require any further assistance.

 

Regards,

Maithiliy K


peter foley
Replied On March 14, 2013 08:04 PM

I have looked at your example (thanks) but my situation is a bit more complex.

The Asset class contains 2 other classes. It is these other classes I wish to be used as the datasource for the dropdowns (see Assett\Index controller and Asset.cshtml view) to set Fleet and Asset Type.

I want to show FleetName for Fleet when reading the grid and the dropdown when editing.Maybe I need some form of Template?


FleetPlanner_596e041a.zip

Bala Murugan A.S [Syncfusion]
Replied On April 1, 2013 02:58 AM

Hi Peter,

Sorry for the inconvenience caused.

Currently we are working on this with high priority and we will update you in one business day(April 2,2013).

Please let us know if you have any concerns.

Regards,
Bala Murugan A.S

paul jilek
Replied On April 16, 2013 12:12 AM

Hi Bala
 
I have the same requirement as Peter.  Could you please inform me of the outcome?
 
Cheers
 
Paul

Bala Murugan A.S [Syncfusion]
Replied On April 25, 2013 12:12 AM

Hi Paul,

Thanks for your update.

We suggest you to refer the Direct Trac incident 107426 for your query.

Please let us know if you have any other concerns.

Regards,
Bala Murugan A.S

Murugan
Replied On May 8, 2013 07:43 PM

I am also facing the similar kind of problem.

cols.Add(c => c.TitleName).HeaderText("Title").Width(30).CellEditType(CellEditType.DropdownEdit).DropDownDataSource((System.Collections.IEnumerable)ViewData["DropDownSource"], "Name""Id");

I have to display the "Mr / Mrs / Dr" and so on. When I select the text from the dropdownlist and move to the next row - the value has been display in the grid rather than the selected text.

Please find the attachment of the screen shot and let me know the solution. 



GridDropdownlist_6876da3b.rar

Bala Murugan A.S [Syncfusion]
Replied On May 13, 2013 11:50 PM

Hi Murugan,

Thanks for your update.

Currently we are analyzing on your query with high priority and we will update you on May 17,2013.

Please let us know if you have any concerns.

Regards,
Bala Murugan A.S

Stephanie L. Hayden
Replied On April 2, 2014 08:02 PM

Has this issue been resolved? If so, is there a sample available?

Prabhu Sarvesan [Syncfusion]
Replied On April 3, 2014 03:38 AM

Hi Stephanie,

 

Thanks for your interest in Syncfusion products.

 

We have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We will update you when this feature has been implemented

 

Disclaimer: The date for the feature implementation is tentative and not a commitment on our parts.

 

Please let us know if you need any further assistance.

 

Regards,

Prabhu Sarvesan


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.

;