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

Hiding Hierarchy column server side

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mathieu
Top achievements
Rank 1
mathieu asked on 26 Oct 2011, 03:13 PM
Hey, how can i hide a hierarchy column in a radgrid from the server side (VB.NET)?

Depending on authorisation, for exemple if a checkbox is checked.
(Not working)
if mycheckbox.checked = true then
    radgrid1.columns(0).display = false
    radgrid1.columns(0).visible = false
End if

(working, only hide the arrow in the hierarchy column)

Dim

 

 

 numberoflines As Integer = radgrid1.Items.Count

 

 

 

For i = 0 To numberoflines - 1

 

radgrid1.Items(i).Cells(0).Controls(0).Visible =

 

False

 

 

 

Next i

 


I need to hide the column because the waste of space in the grid.
I dont want to make another radgrid in copy without the detailtable and call:
if mycheckbox.checked = true then
    radgrid1.visible = true
    radgrid2.visible = false
else
    radgrid1.visible = false
    radgrid2.visible = true
End if

How can i hide the column(0) of the radgrid in the server side?

TY for your reply


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Oct 2011, 05:15 AM
Hello Mathieu,

You can try the following code snippet to hide a column on checking the CheckBox.
VB:
Protected Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
    Dim chk As CheckBox = TryCast(sender, CheckBox)
    Dim dataItem As GridDataItem = DirectCast(chk.NamingContainer, GridDataItem)
    Dim tablview As GridTableView = DirectCast((dataItem).ChildItem.NestedTableViews(0), GridTableView)
    If chk.Checked Then
        tablview.GetColumn("UniqueName").Visible = False
    End If
End Su

Thanks,
Shinu.
Tags
Grid
Asked by
mathieu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or