How to pinned column when Viewdefinition value of radDataGridview using Htmlview.

1 Answer 79 Views
GridView
Kei
Top achievements
Rank 1
Kei asked on 19 Jul 2022, 01:10 PM

I created the ViewDefinition value of RadGridView using HtmlViewDefinition, and I want to give the Pinned property to the first, second, and third columns.
However, the result is created by duplicating three columns as in the screenshot.

How to fix it?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Jul 2022, 06:49 AM
 Hello, Kei,  


By default, the context menu items for pinning the columns is eligible only for TableViewRowLayout and the root level groups of the ColumnGroupsViewDefinition. For the HtmlViewRowLayout, pinning is not allowed since the columns may be spanned among different rows/columns. 

I would recommend you to consider using the ColumnGroupsViewDefinition: https://docs.telerik.com/devtools/winforms/controls/gridview/view-definitions/column-groups-view

        private void RadForm1_Load(object sender, EventArgs e)
        { 
            this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
            this.radGridView1.DataSource = this.customersBindingSource;
            this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

            ColumnGroupsViewDefinition view = new ColumnGroupsViewDefinition();
            view.ColumnGroups.Add(new GridViewColumnGroup("Customer Contact"));
            view.ColumnGroups.Add(new GridViewColumnGroup("Details"));
            view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Address"));
            view.ColumnGroups[1].Groups.Add(new GridViewColumnGroup("Contact"));
            view.ColumnGroups[0].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[0].Rows[0].ColumnNames.Add("CompanyName");
            view.ColumnGroups[0].Rows[0].ColumnNames.Add("ContactName");
            view.ColumnGroups[0].Rows[0].ColumnNames.Add("ContactTitle");
            view.ColumnGroups[1].Groups[0].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add("Address");
            view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add("City");
            view.ColumnGroups[1].Groups[0].Rows[0].ColumnNames.Add("Country");
            view.ColumnGroups[1].Groups[1].Rows.Add(new GridViewColumnGroupRow());
            view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add("Phone");
            view.ColumnGroups[1].Groups[1].Rows[0].ColumnNames.Add("Fax");
            radGridView1.ViewDefinition = view;

            view.ColumnGroups[1].PinPosition = PinnedColumnPosition.Left;
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Kei
Top achievements
Rank 1
commented on 21 Jul 2022, 05:21 AM

That's sad,
But thanks for the reply.
Tags
GridView
Asked by
Kei
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or