I have a scenario in my application as follows:
I have a two combo boxes. One ComboBox has Control Types(such as TextBox, RadButton, ...). If I select any Control Type, the corresponding Control Names which I used in my application will display in the second ComboBox.
(For your understanding purpose : I'm using two RadButtons namely Button1 and Button2 in my application. If I select RadButton in first ComboBox, the names "Button1" and "Button2" will display in the second ComboBox). It is done.
Similarly, I wanna get the MenuItem's Names I used under RadGridView. But it is not getting the MenuItems. Please kindly reply me how to acheive this.
The following is the code I've used to get the names of the selected control type:
Private
Sub GetControlNames(ByVal oControl As Object)
Try
If IsNothing(oControl) Then GoTo lable1
Dim child As Object
If oControl.GetType.Name = "String" Then GoTo lable1
For Each child In LogicalTreeHelper.GetChildren(oControl)
If sSelectedControl = child.GetType.Name Then
cmbControlsName.Items.Add(child.Name)
End If
GetControlNames(child)
Catch ex As Exception
ShowMessage(ex.Message)
End Try
End Sub
Note: I have the above said two ComboBoxes and a Frame in one Page and the Frame will load another page namely Page1 in it. The content of the Frame will be passed as the argument for the above function.
Here, I have used the Recursive function(well you know). When the RadGridView is passed as the argument of the function, it jumps to the label "lable1" from "For Each" statement. So, it means the RadGridView doesn't have children. Then, how can I get the MenuItem I've used under RadGridView. Please let me know the solution.
Thanks and Regards,
Azharshah H
Software Developer