Articles in this section
Category / Section

How to hide a dimension inside AxisElementBuilder?

1 min read

You can hide a dimension inside AxisElementBuilder using the following code example.


void OlapClient1_PreRender(object sender, EventArgs e)
    if (this.OlapClient1.AxisElementBuilderSlicer.Controls.Count > 0 && this.OlapClient1.AxisElementBuilderSlicer.Controls[0].Controls.Count > 0 && this.OlapClient1.AxisElementBuilderSlicer.Controls[0].Controls[0] is Label)
       for (var i = 0; i < this.OlapClient1.AxisElementBuilderSlicer.Controls.Count; i++)
           if (!(OlapClient1.AxisElementBuilderSlicer.Controls[i] is SplitButton)) continue;
           if (((Label)OlapClient1.AxisElementBuilderSlicer.Controls[i].Controls[0]).Text == "Date") // To find the dimension by its name
              OlapClient1.AxisElementBuilderSlicer.Controls[i].Visible = false; // To hide the respective dimension


Private Sub OlapClient1_PreRender(ByVal sender As Object, ByVal e As EventArgs)
                If Me.OlapClient1.AxisElementBuilderSlicer.Controls.Count > 0 AndAlso Me.OlapClient1.AxisElementBuilderSlicer.Controls(0).Controls.Count > 0 AndAlso TypeOf Me.OlapClient1.AxisElementBuilderSlicer.Controls(0).Controls(0) Is Label Then
                   For i = 0 To Me.OlapClient1.AxisElementBuilderSlicer.Controls.Count - 1
                                   If Not(TypeOf OlapClient1.AxisElementBuilderSlicer.Controls(i) Is SplitButton) Then
                                   Continue For
                                   End If
                                   If (CType(OlapClient1.AxisElementBuilderSlicer.Controls(i).Controls(0), Label)).Text = "Date" Then ' To find the dimension by its name
                                                  OlapClient1.AxisElementBuilderSlicer.Controls(i).Visible = False ' To hide the respective dimension
                                   End If
                   Next i
                End If
End Sub


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment