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

Bound column defaults to invisible

1 Answer 44 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.
oliwa
Top achievements
Rank 1
oliwa asked on 27 Jan 2012, 04:34 PM
I have a grid with a bound column that is a short data type and is configured in OpenAccess a foreign key.  In order for it to show up I have to explicitly set the visibility to true.  In addition to this I cannot use the column in a default filter using Grid.Filterable.  If I copy the value into a new property everything works as expected but I'd rather not create a new column just for this purpose.  It seems to me like the grid shouldn't care that it is a foreign key.

@(Html.Telerik().Grid<AdminTrainingViewModel>()
        .EnableCustomBinding(true)
        .Name(string.Format("{0}Grid", Model))
        .DataBinding(x =>
                        {
                            x.Ajax().Select("GetGridData", "AdminTraining");
                            x.Ajax().Update("Deny", "AdminTraining");
                            x.Ajax().Delete("Approve", "AdminTraining");
                        }
        )
        .Columns(x =>
                    {
                        x.Bound(y => y.FullName);
                        x.Bound(y => y.TrainingStatusId).Visible(true);
                        x.Bound(y => y.RepCategoryName);
                        x.Bound(y => y.TrainingDate).Format("{0:MM/dd/yyyy}").Width(100);
                        x.Bound(y => y.Activity);
                        x.Bound(y => y.Purpose);
                        x.Bound(y => y.NumOfHours).Format("{0:#,##0.00}").Width(60);
                        x.Command(y => y
                                        .Custom("Approve")
                                        .Ajax(true)
                                        .Action("Approve", "AdminTraining")
                                        .DataRouteValues(z => z.Add(m => m.TrainingId).RouteKey("trainingId"))
                                        .ButtonType(GridButtonType.Image)
                            ).Visible(Model != TrainingStatus.Approved).Width(50);
                        x.Command(y => y.Edit().ButtonType(GridButtonType.Image)).Visible(Model != TrainingStatus.Denied).Width(50);
                    }
        )
        .Editable(x => x.Mode(GridEditMode.PopUp))
        .DataKeys(x => x.Add(y => y.TrainingId))
        .Pageable(x =>
                    {
                        x.PageSize(20);
                        x.Style(GridPagerStyles.Status);
                        x.PageOnScroll(true);
                    })
        .Sortable(x => x.OrderBy(y => y.Add(z => z.UpdateDate).Descending()))
        .ClientEvents(x => x.OnComplete("AdminTrainingGrid_OnComplete"))
        .ClientEvents(x => x.OnEdit("AdminTrainingGrid_OnEdit"))
)

This post is a duplicate of this one but I accidentally posted in the wrong forum.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 30 Jan 2012, 12:25 PM
Hello Brian,

I tried to reproduce the problem you wrote about but to no avail. Could you send a sample project so I can check the exact setup?

All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
oliwa
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or