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

Multiple rows cannot be pinned simultaneously

7 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Uday
Top achievements
Rank 1
Uday asked on 30 Sep 2011, 10:30 AM
Hello all,

This is my first post after i started working with Telerik Radcontrols for winforms.
Currently i would like to select multiple rows from the grid and i would like to pin them all (either at top or bottom).

At present, eventhough it is possible to select multiple rows, only the first row is pinned.

Is it possible to extend the rad grid row header context menu, item click event handler ? such an event handler is really available in the first place ? Kindly throw some light guys....

7 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 30 Sep 2011, 11:37 AM
Hello Ulday,

Apparently there is a problem with the row pinning mechanism when multi select is active, for the moment you can use the following workaround: Register for the ContextMenuOpening and do the following:

private void _radGridView_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    if (e.ContextMenuProvider is GridRowHeaderCellElement)
    {
        var pinnedStateItem = e.ContextMenu.Items[0] as RadMenuItem;
        if (pinnedStateItem == null)
        {
            e.Cancel = true;
            return;
        }
 
        foreach (RadMenuItem menuItem in pinnedStateItem.Items)
        {
            switch (pinnedStateItem.Items.IndexOf(menuItem))
            {
                case 0:
                    menuItem.Tag = PinnedRowPosition.None;
                    break;
                case 1:
                    menuItem.Tag = PinnedRowPosition.Top;
                    break;
                case 2:
                    menuItem.Tag = PinnedRowPosition.Bottom;
                    break;
            }
 
            menuItem.MouseDown -= new MouseEventHandler(menuItem_MouseDown);
            menuItem.MouseDown += new MouseEventHandler(menuItem_MouseDown);
        }
    }
}
 
private void menuItem_MouseDown(object sender, MouseEventArgs e)
{
    var menuItem = sender as RadMenuItem;
    if (menuItem == null)
    {
        return;
    }
 
    var pinState = menuItem.Tag != null ? (PinnedRowPosition)menuItem.Tag : (PinnedRowPosition.None);
 
    foreach (var selectedRow in _radGridView.SelectedRows.ToArray().Where(selectedRow => selectedRow != _radGridView.SelectedRows.Last()))
    {
        selectedRow.PinPosition = pinState;
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Uday
Top achievements
Rank 1
answered on 01 Oct 2011, 08:03 AM
Thank you so much Emanuel.  Its working great!
However, unpinning the pinned rows doesnt seem to be possible since the multi-select (rubber rectangle) feature is not working over pinned rows. Is that a known bug ?
0
Uday
Top achievements
Rank 1
answered on 03 Oct 2011, 01:24 PM
Hi Emanuel,

The multi-select option for pinned rows is still not working. Does the gridview control have any events for translucent rectangle ? so that i can hook my code in that

regards,
Uday
0
Emanuel Varga
Top achievements
Rank 1
answered on 03 Oct 2011, 01:43 PM
Hello again,

To get this fixed in a future release i would suggest opening a support ticket with a link to this post.

For a workaround it's not that easy, because i don't remember exactly where is the selection initiated, i will try to dig into this problem some more tonight and i will get back to you.

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Martin Vasilev
Telerik team
answered on 04 Oct 2011, 11:56 AM
Hello guys,

There is not an easy work-around to made the translucent selection rectangle to work for the pinned rows. We will improve this in one of the next releases. For the time being, pinned rows can be selected by Ctrl+Mouse Click combination.

We also will consider including built-in support for pinning multiple rows at once in the future.

Uday, I have updated your Telerik points for bringing this to our attention. Let us know if you have any additional questions.

Greetings,
Martin Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Uday
Top achievements
Rank 1
answered on 04 Oct 2011, 07:33 PM
Hi Martin,

Thanks for adding those points. But still i couldnt able to create a support ticket for this issue. Can you tell me whats wrong. Am always pointed to the "three step" page.
0
Martin Vasilev
Telerik team
answered on 07 Oct 2011, 08:42 PM
Hi Uday,

In order to create a new support thread you need to be logged into your account, than go to "Your Account" -> "Get Support", and there you will see a "Contact Support Team" option. Please keep in mind that you required to be a licensed customer with a valid subscription or a user with a Trial support package to create support enquiry.

Regards,
Martin Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Uday
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Uday
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or