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

GridView with RowDetails

11 Answers 248 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Slade
Top achievements
Rank 2
Richard Slade asked on 24 Sep 2010, 03:24 PM
Hi, 

I'm trying to replicate the RowDetails grid that is in the demo. It works in that a row details row is shown under each row correctly, but I'm having an issue
The column that I am using as the RowDetails column is still showing it's header and has a blank area
If I set the column to IsVisible=False, then the RowDetails don't show. 


I've attached a pretty crude screenshot (it's just a test before I put this into our main project) 
Thanks all 
Richard

11 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 24 Sep 2010, 04:38 PM
Hello Richard,

I'm guessing you forgot this:
public GridViewDataColumn DetailsColumn
        {
            get
            {
                return this.detailsColumn;
            }
            set
            {
                if (detailsColumn != value)
                {
                           detailsColumn = value;
                    if (detailsColumn != null)
                    {
                                 detailsColumn.MinWidth = 0;
                        detailsColumn.Width = 1;
                        detailsColumn.ReadOnly = true;
                    }

                    this.TableElement.Update(GridUINotifyAction.Reset);
                }
            }
        }

You should just set the width, minWidth, maxWidth to 0 and it should solve your problem.

Hope this helpls,
Best Regards,
Emanuel Varga
0
Richard Slade
Top achievements
Rank 2
answered on 24 Sep 2010, 04:46 PM
Thanks for the reply... No, I copied from the demo this.. 

Public Property DetailsColumn() As GridViewDataColumn
    Get
        Return Me.detailsColumn_Renamed
    End Get
    Set(ByVal value As GridViewDataColumn)
        If detailsColumn_Renamed IsNot value Then
            detailsColumn_Renamed = value
            If detailsColumn_Renamed IsNot Nothing Then
                detailsColumn_Renamed.MinWidth = 0
                detailsColumn_Renamed.Width = 50
                detailsColumn_Renamed.ReadOnly = True
            End If
            Me.TableElement.Update(GridUINotifyAction.Reset)
        End If
    End Set
End Property
0
Emanuel Varga
Top achievements
Rank 1
answered on 24 Sep 2010, 04:49 PM
Hello again,

This is fun, they made a mistake on the vb side, just try what i sent you, put the width = 0 and maxWidth = 0 and let me know, ok?

Best Regards,
Emanuel Varga
0
Richard Slade
Top achievements
Rank 2
answered on 24 Sep 2010, 04:57 PM
ah yes, well spotted. Thanks!
0
Richard Slade
Top achievements
Rank 2
answered on 24 Sep 2010, 05:08 PM
hmm, thought that would have got it.. but hasn't. Will try again Monday. 
Public Property DetailsColumn() As GridViewDataColumn
    Get
        Return Me.detailsColumn_Renamed
    End Get
    Set(ByVal value As GridViewDataColumn)
        If detailsColumn_Renamed IsNot value Then
            detailsColumn_Renamed = value
            If detailsColumn_Renamed IsNot Nothing Then
                detailsColumn_Renamed.MinWidth = 0
                detailsColumn_Renamed.Width = 0
                detailsColumn_Renamed.MaxWidth = 0
                detailsColumn_Renamed.ReadOnly = True
            End If
            Me.TableElement.Update(GridUINotifyAction.Reset)
        End If
    End Set
End Property
0
Emanuel Varga
Top achievements
Rank 1
answered on 24 Sep 2010, 05:13 PM
Hello again,

Sorry, I've got that wrong the width and maxWidth should be 1 NOT 0.

This will work, I've just tested it and it's OK, it's just strange in one way but it's normal in another way because if it is 0 then visible should be false and then you will have no date.

Best Regards,
Emanuel Varga,
0
Richard Slade
Top achievements
Rank 2
answered on 24 Sep 2010, 05:41 PM
That's got it. Thanks for your effort. Not obvious though eh!?
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 27 Sep 2010, 10:52 AM
Hi Emanuel

Any ideas how to get all the rows to pre-expand to show the details column please? I've only got a few rows and would like them to all be expanded by default. 
Cheers
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 27 Sep 2010, 10:56 AM
not to worry, answered my own question

Public Overrides Sub UpdateInfo()
    Me.RowInfo.Height = (CType(Me.GridControl, RowDetailsGrid)).DetailsRowHeight
    'If (Not Me.RowInfo.IsCurrent) Then
    '    'Me.RowInfo.Height = TableElement.RowHeight
    'Else
    '    Me.RowInfo.Height = (CType(Me.GridControl, RowDetailsGrid)).DetailsRowHeight
    'End If
    MyBase.UpdateInfo()
End Sub
0
Emanuel Varga
Top achievements
Rank 1
answered on 27 Sep 2010, 11:00 AM
Hello Richard,

Have you tried already with going trough all the rows and setting IsExpanded = true?
row.IsExpanded = true;

I am thinking it should be like for hierarchical grids, like this article explains...

Sorry but I cannot test it right now, i will try to take a look soon if this is not working, please let me now, ok?

Best Regards,
Emanuel Varga
0
Richard Slade
Top achievements
Rank 2
answered on 27 Sep 2010, 11:02 AM
Thanks for the quick reply. It's fine though. The one I posted above works fine. 
Richard
Tags
GridView
Asked by
Richard Slade
Top achievements
Rank 2
Answers by
Emanuel Varga
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Share this question
or