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

How to get all textbox control in a RadWindow and how to set selecteditem of a RadComboBox.

5 Answers 65 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
tungnt185
Top achievements
Rank 2
tungnt185 asked on 30 Mar 2010, 08:44 AM
Hello Telerik team.
I've some question about RadComboBox as below:

1) I've a RadWindow with many controls on it: Textbox, RadDateTime, RadComboBox ...
I want to find all Textbox control and I'm using:

CType

 

(frmParam.Content, UIElement).ChildrenOfType(Of TextBox)()

But it return all textbox like: PickerTextbox(RadDateTime, ComboBox) with name as 'InputBox', 'PART_EditableTextBox'
So how can I retrieve all Textbox, except PickerTextbox

2) In RadWindow I've a RadComboBox binding to a entity with SelectedValuePath='ID' type guid
When RadWindow closed, I save this SelectedValue to a database.
So If I open this RadWindow again, how can I set selected value of the RadComboBox by this SelectedValue(guid) from database

Thanks.

 

5 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 30 Mar 2010, 08:55 AM
Hello Taufik,

First of all I would strongly recommend avoiding the ChildrenOfType method at any cost. Because it could bring serious performance penalties. It is much better to design your application around MVVM - widely used design pattern in Silverlight and WPF - when you use it you will not need any references to the UI controls, generally you will not have to handle events, etc. If you really have to use ChildrenOfType, you could loop the returned array of TextBox controls and process only those which Type is exactly TextBox, not a descendant type.

Regarding your second question, if you set the SelectedValue property of RadComboBox, the control will automatically select the specified item.

Best wishes,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
tungnt185
Top achievements
Rank 2
answered on 30 Mar 2010, 09:24 AM
Hi Hristov.

Can you show me more detail about using "array of TextBox controls and process only those which Type is exactly TextBox, not a descendant type". I don't know how to get TextBox, not a descendant type.

I've already set SelectedValue of RadComboBox but have no result. I think because it's a guid value 's get from database

Regards.




0
tungnt185
Top achievements
Rank 2
answered on 31 Mar 2010, 03:27 AM
Hi again,

I've resolve the second question because I've not yet convert it to guid value when assign.
But the first question is remain. I don't know how to get exactly TextBox not a descendant type

Regards.
0
Accepted
Konstantina
Telerik team
answered on 02 Apr 2010, 09:30 AM
Hi Taufik,

Thank you for your question.

Please find the attached project in which is illustrated how you can find only the TextBoxes which are not descendant.

If you have any other questions please feel free to contact us again.

Kind regards,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
tungnt185
Top achievements
Rank 2
answered on 05 Apr 2010, 04:55 AM
Thanks Konstantina,

This's my need. My problem's solve now.

Regards.
Tags
ComboBox
Asked by
tungnt185
Top achievements
Rank 2
Answers by
Valeri Hristov
Telerik team
tungnt185
Top achievements
Rank 2
Konstantina
Telerik team
Share this question
or