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

Issue with RadComboBoxElements in GridView Cells

6 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeremy Murtishaw
Top achievements
Rank 1
Jeremy Murtishaw asked on 30 Jan 2010, 06:06 AM
Hello,

Attached is a screenshot of a problem I'm observing with RadComboBoxElements that I am adding to gridview cells. I have not done anything special to cause the drawing of the textitem component of the RadComboBoxElement to gain precedence over the column headers, but they are, somehow. If I continue to scroll down, they will disappear behind the column headers eventually. I've tried setting the zIndex of the RadComboBoxElements to negative numbers but it's not helping...

Thanks!
Jeremy

6 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 01 Feb 2010, 10:14 AM
Hello Jeremy Murtishaw,

The combobox element contains a textbox control which is a different window. The column header is just another RadElement and is part of the grid control. Because of this, it is not possible to clip the textbox control. Nevertheless, it could be possible to hide this control until you click on it. Please, send me your application and I will try to find a solution.

I am looking forward to your reply.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jeremy Murtishaw
Top achievements
Rank 1
answered on 21 Mar 2010, 10:09 AM

Hi Jack,

I'm still having trouble with this issue, now in Q1 2010. Is it really necessary that I send you a project? I figure this should be pretty easily reproducible, and my project is massive... I was thinking that perhaps there could be a workaround if Fast Scrolling is turned on. Perhaps you could show me how to handle the VScrollBar_ValueChanged event and use ScrollTo the first Visual Row in such a way that it's not clipped, or something...

Thanks!
Jeremy

 

0
Mathieu Yargeau
Top achievements
Rank 1
answered on 21 Mar 2010, 05:58 PM
I had a the same problem trying to insert RadComboBoxElement in the header cell, one combobox per column, they were overlaping the other columns when scrolling to the right.

In your case (well, I don't kno the full extend of your program),it seems you simply can use a GridViewComboBoxColumn for the purge settings. It'ss a type of column that uses cells looking like textboxes, but when you click in them, the radcomboboxelement appear.

If you have custom fuctionnalities in your column, you can creates custom cells that wll inherit the GridComboBoxCellElement class (which is the type of cell used by the GridViewComboBoxColumn), and set them in the CreateCell event. You can change the celltype of any of the grid's cell, so a can place a GridComboBoxCellElement in a specific row of a GridVIewCheckBoxColumn if you wanted to.

private void RGridView_CreateCell(object sender, GridViewCreateCellEventArgs e)     
{     
    //Makes sure it's the right column and not the column's header
    if (e.Column.Index == 3 && !(e.Row is GridTableHeaderRowElement))     
    {     
        e.CellElement = new CustomComboBoxCell(e.Column, e.Row);     
    }     
}    
 

Another wa would be to use a default column (GridViewDataColumn or GridViewTextBoxColumn) and add the RadComboBoxElement in the CellBeginEdit event (removing the combobox and leaving the value in the textbox when the CellEndEdit event fires), which mimic the GridViewComboBox column behaviour. That way, the combobox is not visible when you scroll, but the selected value is.

I can't be more specific for the moment since I do not have my project available at home, so I hope it was clear enough and that it helps.
0
Accepted
Jack
Telerik team
answered on 24 Mar 2010, 01:53 PM
Hi Mathieu, thank you for the sharing your idea with the community.

Jeremy, you can access the vertical scrollbar by using the VScrollBar property of GridTableElement:
this.radGridView1.GridElement.VScrollBar.ValueChanged +=new EventHandler(VScrollBar_ValueChanged);

You can use the following code to make the first data row fully visible:
for (int i = 0; i < this.radGridView1.GridElement.VisualRows.Count; i++)
{
    GridDataRowElement firstDataRow = this.radGridView1.GridElement.VisualRows[i] as GridDataRowElement;
    if (firstDataRow != null)
    {
        firstDataRow.RowInfo.EnsureVisible();
        break;
    }
}

However, please consider the suggestion given by Mathieu. I will be able to give more suggestions if you provide me with additional details about what exactly you are trying to achieve.

Kind regards,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jeremy Murtishaw
Top achievements
Rank 1
answered on 24 Mar 2010, 05:25 PM
Hello,

Thanks for the responses guys! I've given Jack's method a try, and it seems to work really well, except for one thing. When I set the grid to have FastScrolling on, and put this VScrollBar_ValueChanged event in, it allows me to grab the scroll bar and move up and down, or click the up arrow or the space between the up arrow and the scroll bar, but it will not allow me to scroll by clicking the down arrow or the space between the down arrow and the scroll bar. If that could be fixed, I think this solution would work. I'm also going to try to implement Mathieu's method to see how that looks. 

Thanks!
Jeremy
0
Accepted
Jack
Telerik team
answered on 25 Mar 2010, 10:56 AM
Hi Jeremy Murtishaw,

You should also handle the Scroll event of the VScrollBar. It fires before ValueChanged event and indicates the exact action in its arguments. 

All the best,
Jack
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Jeremy Murtishaw
Top achievements
Rank 1
Answers by
Jack
Telerik team
Jeremy Murtishaw
Top achievements
Rank 1
Mathieu Yargeau
Top achievements
Rank 1
Share this question
or