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

[Solved] Pop-up edit mode on a 2nd grid

0 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alexandre
Top achievements
Rank 1
Alexandre asked on 04 May 2011, 02:08 PM
Hi,

In my example, when I select an item in the first grid, a set of items is displayed in the second grid. I would like to allow editing on these elements. I've added an edit command in the second grid but when I click on the "edit" button, only the "cross" of the pop-up edit mode appears although I well get back the key of the 2nd grid item.

Here is the route: 
/Choice/CDSChoice/13607?Movements-mode=select&Comments-mode=edit
My aim is to edit the item 13607. I don't know if I have to differenciate the controller for each grid.

Here is my code aspx:
<%= Html.Telerik().Grid((IEnumerable<TelerikMvcApplication1.Models.Movement>)ViewData["Movements"])
        .Name("Movements")
        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image))
        .DataKeys(keys => keys.Add(o => o.REFERENCE))
        .DataBinding(dataBinding =>
        {
            dataBinding.Server()
                   .Select("CDSChoice", "Choice")
                   .Insert("Insert", "Choice")
                   .Update("Save", "Choice")
                   .Delete("Delete", "Choice");
        })           
        .Columns(columns =>
        {
            columns.Command(commands => commands.Select().ButtonType(GridButtonType.Text)).Title("Select");
            
            columns.Bound(o => o.REFERENCE).Width(130).Title("Reference");
            columns.Bound(o => o.TITLE).Width(250).Title("Title");
            columns.Bound(o => o.TYPE_CODE).Title("Type");
            columns.Bound(o => o.STATUS_CODE).Title("Status");
            columns.Bound(o => o.SEVERITY_CODE).Title("Severity");
            columns.Bound(o => o.IN_CHARGE).Title("In charge");
            columns.Bound(o => o.REQUEST_DATE).Format("{0:dd/MM/yyyy}").Title("Request Date");
            columns.Bound(o => o.PROCESSING_DATE).Format("{0:dd/MM/yyyy}").Title("Processing Date");
            columns.Bound(o => o.DELIVERY_DATE).Format("{0:dd/MM/yyyy}").Title("Delivery Date");
            columns.Bound(o => o.CLOSING_DATE).Format("{0:dd/MM/yyyy}").Title("Closing Date");
            columns.Bound(o => o.TYPE_CODE_SIG).Title("Type SIG");
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Image);
                commands.Delete().ButtonType(GridButtonType.Image);
 
            }).Width(80);
        })
        .RowAction(row =>
        {
            if (!row.DataItem.DELIVERY_DATE.HasValue)
            {
                row.HtmlAttributes["style"] = "background:red;";
            }
            if (row.InEditMode) ViewData["sel"] = row.DataItem.REFERENCE;
        
        })
        .Editable(editing => editing.Mode(GridEditMode.PopUp).DefaultDataItem(new TelerikMvcApplication1.Models.Movement {REFERENCE = "111111-A.11"  }))
        .Pageable(pase => pase.PageSize(7))      
        .Resizable(resizing => resizing.Columns(true))       
        .Filterable()
        .Sortable()
%>
<h3>Comments (<span id="movementID"><%= ViewData["id"] %></span>)</h3>
 
<%= Html.Telerik().Grid((IEnumerable<TelerikMvcApplication1.Models.Comment>)ViewData["Comments"])
        .Name("Comments")
        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image))
        .DataKeys(keys => keys.Add(o => o.ID_COMMENT))
        .DataBinding(dataBinding =>
        {
            dataBinding.Server()
                    .Insert("InsertComment", "Choice")
                    .Update("SaveComment", "Choice")
                    .Delete("DeleteComment", "Choice");
        })
        .Columns(columns =>
        {           
            columns.Bound(c => c.COMMENT);
            columns.Bound(c => c.DATE).Width(200).Format("{0:dd/MM/yyyy}");
            columns.Command(commands =>
            {
                commands.Delete().ButtonType(GridButtonType.Image);
                commands.Edit().ButtonType(GridButtonType.Image);
 
            }).Width(80);
        })
        .Editable(editing => editing.Mode(GridEditMode.PopUp).Window(w => w.Title("Add new comment for the movement " + (string)ViewData["sel"])).DefaultDataItem(new TelerikMvcApplication1.Models.Comment { ID_MOVEMENT = (string)ViewData["sel"], DATE = DateTime.Now }))
        .Scrollable(scro => scro.Height(120))
        .Sortable()       
%>
Tags
Grid
Asked by
Alexandre
Top achievements
Rank 1
Share this question
or