This is a migrated thread and some comments may be shown as answers.

Server Editing Grid not updated through the joined coloumn

1 Answer 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vinay
Top achievements
Rank 1
Vinay asked on 07 Sep 2012, 11:02 AM

When i am trying to update the value through the join it updated the database but not updating the gridview.
But after refreshing the page it is showing the updated value.
Here is my code.

@(Html.Kendo().Grid(Model)

.Name(

 

"Grid")

 

.Columns(columns =>

{

 

columns.Bound(p => p.RoleTypeName).HtmlAttributes(

 

new { style = "text-align: left" }).Width(90);

 

columns.Bound(p => p.Name).HtmlAttributes(

 

new { style = "text-align: left" }).Width(100);

 

columns.Bound(p => p.Status).HtmlAttributes(

 

new { style = "text-align: center" }).Width(80);

 

columns.Command(command => { command.Edit(); }).HtmlAttributes(

 

new { style = "text-align: center" }).Width(100);

 

})

.Editable(editable => editable.Mode(

 

GridEditMode.PopUp).TemplateName("PopUpTemplate").Window(w => w.Title("Manage Role").Name("editWindow").Width(400).Height(200)))

 

.Pageable(p => p.PageSizes(

 

true))

 

.Sortable()

.Scrollable()

.DataSource(dataSource => dataSource

 

 

//.Server()

 

.Ajax()

.ServerOperation(

 

false)

 

 

.Model(model => model.Id(p => p.RoleID))

.Read(read => read.Action(

 

"ManageRole", "ManageRole"))

 

.Update(update => update.Action(

 

"Update", "ManageRole"))

 

 

)

)

 


and my editor template contains dropdownlist

@(Html.Kendo().DropDownListFor(model => model.StatusName)

.Name(

 

"StatusName")

 

.DataTextField(

 

"StatusName")

 

.DataValueField(

 

"StatusName")

 

.DataSource(source =>

{

source.Read(read =>

{

read.Action(

 

"GetStatus", "ManageRole");

 

});

})

 

)

When i update the status from the dropdownlist updates in data but not show in grid, it appear when refreshing the page.How can i remove this problem please help me out. 

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Sep 2012, 10:28 AM
Hello Vinay,

I am not sure if I understand correctly the exact scenario. From the code it seems that the DropDownList is used to edit a property with name "StatusName" and there does not seem to be a column bound to this property in the Grid. Could you clarify which property needs to be updated? 
As general information I can say that if you need to update a different property than the one that is edited with the dropdown, you can either return the updated item from the action method:

return Json(new [] { myUpdatedModel }.ToDataSourceResult(request, ModelState));
or use the Grid Save event to get the value and set it to the model.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Vinay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or