Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have code in Controller:
C#
[HttpPost, GridAction(EnableCustomBinding = true)]
        public ActionResult List(RegisterTeachingListModel model, GridCommand command)
        {
            if (model == null)
            {
                model = new RegisterTeachingListModel();
            }

            var registerTeaching = _registerTeachingService.Search(
                    semesterValue: model.SearchSemester,
                    sessionValue: model.SearchSession,
                    group: model.SearchGroup,
                    classOpeningId: model.SearchClassOpening,
                    fromDate: model.SearchFromDate,
                    toDate: model.SearchToDate
                    )
                .Select(x =>
                {
                    return x.ToModel();
                }).ForCommand(command);
            int on = (command.Page - 1) * command.PageSize + 1;
            var pagedList = registerTeaching.PagedForCommand(command)
                .Select(x =>
                {
                    var registerTeachingModel = x;

                    if (x.SubjectAssignmentId != 0)
                    {
                        var SubjectAssignment = ServiceFacade.SubjectAssignmentService.GetById(x.SubjectAssignmentId);
                        if (SubjectAssignment != null)
                            registerTeachingModel.SubjectName = SubjectAssignment.SubjectDeclaration.Subject.SubjectBase.Name;
                    }
                    if (x.StaffId != 0)
                    {
                        var staff = ServiceFacade.StaffService.GetById(x.StaffId);
                        if (staff != null)
                        {
                            registerTeachingModel.StaffName = staff.FullName;
                        }

                    }
                    if (x.ClassOpeningId != 0)
                    {
                        var classOpening = ServiceFacade.ClassOpeningService.GetById(x.ClassOpeningId);
                        if (classOpening != null)
                            registerTeachingModel.ClassName = classOpening.Name;
                    }
                    if (x.Course == (Course)1)
                    {
                        registerTeachingModel.IsShowing = true;
                    }


                    registerTeachingModel.ON = on++;
                    return registerTeachingModel;
                });
            model.RegisterTeachings = new GridModel<RegisterTeachingModel>
            {
                Data = pagedList,
                Total = registerTeaching.Count()
            };

            return new JsonResult { Data = model.RegisterTeachings };
        }


I have code in View:

C#
@(Html.Telerik().Grid<Nop.Admin.Models.RegisterTeaching.RegisterTeachingModel>()
        .Name("registerTeachings-grid")
        .NoRecordsTemplate(T("Admin.Common.NoRecord").ToString())
        //set keys for model
        .ToolBar(command =>
        {
            //command.Insert();
            //command.Custom().Action("ExportExcel", "RegisterTeaching",
            //    new { /*routeValues here*/}).Text(T("Admin.Common.ExportToExcel").ToString());
        })
        .DataKeys(key =>
        {
            key.Add(model => model.Id);
        })
        //define columns in grid
        .Columns(columns =>
        {
            columns.Bound(c => c.ON)
                .Filterable(false)
                .Sortable(false)
                .HtmlAttributes(new { @class = "t-header" })
                .ReadOnly()
                .Title(T("Admin.Common.#").ToString())
                .Width(50);
            //bound column here

            columns.Bound(c => c.Date).Format("{0:dd/MM/yyyy}");
            columns.Bound(c => c.Course);
            columns.Bound(c => c.ClassOpeningId).ClientTemplate("<#= ClassName #>");
            columns.Bound(c => c.SubjectAssignmentId).ClientTemplate("<#= SubjectName #>");
            columns.Bound(c => c.StaffId).ClientTemplate("<#= StaffName #>");
            columns.Bound(c => c.PPCT);
            columns.Bound(c => c.Replace);
            columns.Bound(c => c.Preparing);
            columns.Bound(c => c.Description);
            //command columns here
            //columns.Command(commands =>
            //{
            //    commands.Edit().ButtonType(GridButtonType.Image);
            //    commands.Delete().ButtonType(GridButtonType.Image);
            //}).Width(78);
        })
                //.Editable(editing => editing.Mode(GridEditMode.PopUp).TemplateName("_CreateOrUpdate").AdditionalViewData(
                //        new
                //        {
                //            AvailableGroups = Model.AvailableGroups,
                //            AvailableLevels = Model.AvailableLevels,
                //            AvailableStaffGroups = Model.AvailableStaffGroups,
                //            AvailableSubjects = Model.AvailableSubjects
                //        })
                //    )
        .Pageable(paging => paging
            .PageSize(gridPageSize)
            .Position(GridPagerPosition.Both)
        )
        .DataBinding(dataBinding => dataBinding.Ajax()
            .Select("List", "RegisterTeaching")
            .Insert("AjaxCreate", "RegisterTeaching")
            .Update("AjaxEdit", "RegisterTeaching")
            .Delete("AjaxDelete", "RegisterTeaching")
        )
        .ClientEvents(events => events
            .OnDataBinding("onDataBinding")
        )
        .Reorderable(reordering => reordering.Columns(true))
        .Selectable()
        .KeyboardNavigation()
        .EnableCustomBinding(true)
        .Scrollable(scroll => scroll.Height("auto"))
    )


Please help me! I want to merge cell (the same to picture)
picture demo
Posted
Comments
Maciej Los 13-May-14 16:07pm    
OK, we know your needs. Please tell us what is wrong and shortly describe your issue.
Võ Ái Duy 13-May-14 22:49pm    
You can see the picture (picture demo). Column Date has many same value. I want to merge the cells have the same value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900