Hello
I have a grid containing product registrations, fetched from a table(registration) in a DB. One of the columns in the registration table is for countryName, country is stored as a FK countryID (int) in the registration table. But in the grid i'm showing the corresponding countryname. I have a popup editor for rows in the grid with a dropdowlist for chosing country, this dropdownlist fetches data from the country table with id as datavaluefield and name as datatextfield.
The code for the country column in the grid:
The code for the dropdownlist:
As you can see the column in the grid is mapped to countryName and the dropdownlist is mapped to countryId. This means changes made in the dropdownlist doesn't get updated in the grid. How can I update the countryName cell in the grid with the selectedTextvalue from the dropdownlist?
/Jonas
I have a grid containing product registrations, fetched from a table(registration) in a DB. One of the columns in the registration table is for countryName, country is stored as a FK countryID (int) in the registration table. But in the grid i'm showing the corresponding countryname. I have a popup editor for rows in the grid with a dropdowlist for chosing country, this dropdownlist fetches data from the country table with id as datavaluefield and name as datatextfield.
The code for the country column in the grid:
columns.Bound(c => c.countryName).Width(120).Locked(
true
);
The code for the dropdownlist:
@(Html.Kendo().DropDownListFor(model => model.countryId)
.HtmlAttributes(
new
{ style =
"width: 183px"
, required =
"required"
})
.DataTextField(
"name"
)
.DataValueField(
"id"
)
.OptionLabel(
"Select country..."
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetCountries"
,
"Home"
);
});
})
)
As you can see the column in the grid is mapped to countryName and the dropdownlist is mapped to countryId. This means changes made in the dropdownlist doesn't get updated in the grid. How can I update the countryName cell in the grid with the selectedTextvalue from the dropdownlist?
/Jonas