Articles in this section
Category / Section

How to check whether measure is present or not in the column and row axes?

1 min read

You can check the presence of measure in row or column axes using AxisElementBuilder’s PreRender that is explained in the following code example.

C#

protected void Page_Load(object sender, EventArgs e)
{
     this.OlapClient1.AxisElementBuilderColumn.PreRender += AxisElementBuilderColumn_PreRender;
}
void AxisElementBuilderColumn_PreRender(object sender, EventArgs e)
{
    if (this.OlapClient1.AxisElementBuilderColumn.Controls.Count > 0 && this.OlapClient1.AxisElementBuilderColumn.Controls[0].Controls.Count > 0 && this.OlapClient1.AxisElementBuilderColumn.Controls[0].Controls[0] is Label)
    {
        for (var i = 0; i < this.OlapClient1.AxisElementBuilderColumn.Controls.Count; i++)
        {
            if (!(OlapClient1.AxisElementBuilderColumn.Controls[i] is SplitButton)) continue;
               if (((Label)OlapClient1.AxisElementBuilderColumn.Controls[i].Controls[0]).Text == "Measures")
               {
                   bool isInColumn = true;
               }
         }
    }
}

VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
                 AddHandler Me.OlapClient1.AxisElementBuilderColumn.PreRender, AddressOf AxisElementBuilderColumn_PreRender
End Sub
Private Sub AxisElementBuilderColumn_PreRender(ByVal sender As Object, ByVal e As EventArgs)
                If Me.OlapClient1.AxisElementBuilderColumn.Controls.Count > 0 AndAlso Me.OlapClient1.AxisElementBuilderColumn.Controls(0).Controls.Count > 0 AndAlso TypeOf Me.OlapClient1.AxisElementBuilderColumn.Controls(0).Controls(0) Is Label Then
                                For i = 0 To Me.OlapClient1.AxisElementBuilderColumn.Controls.Count - 1
                                                If Not(TypeOf OlapClient1.AxisElementBuilderColumn.Controls(i) Is SplitButton) Then
                                                Continue For
                                                End If
                                                   If (CType(OlapClient1.AxisElementBuilderColumn.Controls(i).Controls(0), Label)).Text = "Measures" Then
                                                                   Dim isInColumn As Boolean = True
                                                   End If
                                Next i
                End If
End Sub

 

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