8 Answers, 1 is accepted
You can find it by traversing the visual tree with the WPF VisualTreeHelper, or with our extension method ChildrenOfType<FrameworkElement> (which is acually much easier to use). Can you please share which would be the ultimate goal of this activity? Generally, setting visual properties, or executing custom event logic for the cell elements is not recommended, as this can cause unexpected results when the UI virtualization logic is enabled.
Regards,
Ivan Ivanov
Telerik
hi .. i have xaml code like this ..i want to acsess textbox dropdownllist id by clicking the save button.. i kept button outside the grid please see the code and help me
<telerik:RadGridView Name="LookUpMaster" GotFocus="LookUpMaster_GotFocus"
Grid.Row="0" Style="{DynamicResource GridStyle}" IsReadOnly="False" AutoGenerateColumns="False" CanUserInsertRows="True" NewRowPosition="Top"
AddingNewDataItem="LookUpMaster_AddingNewDataItem"
CellValidating="LookUpMaster_CellValidating"
EditTriggers="CellClick"
SelectionChanging="LookUpMaster_SelectionChanging">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Refrence Code" DataMemberBinding="{Binding CommonRefcd}" UniqueName="CommonRefcd">
<telerik:GridViewDataColumn.CellEditTemplate >
<DataTemplate>
<TextBox x:Name="RefCodeTextBox" LostFocus="RefCodeTextBox_LostFocus" IsReadOnly="True" Text="{Binding CommonRefcd}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Refrence Name" DataMemberBinding="{Binding CommonRefNm}" UniqueName="CommonRefNm" >
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox x:Name="RefNameTextBox" Text="{Binding CommonRefNm}" LostFocus="RefNameTextBox_LostFocus"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Refrence Description" UniqueName="CommonRefDs" DataMemberBinding="{Binding CommonRefDs}" >
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox x:Name="RefDsTextBox" GotFocus="RefDsTextBox_GotFocus" LostFocus="RefDsTextBox_LostFocus"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Refrence Category"
DataMemberBinding="{Binding CommonRefCategory}">
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<SMS:AutoCompleteBox x:Name="CategoryTextBox" GotFocus="CategoryTextBox_GotFocus" LostFocus="CategoryTextBox_LostFocus" QueryName="GetCategory"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Status" DataMemberBinding="{Binding Status}">
<telerik:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<SMS:AutoCompleteBox x:Name="StatusTextBox"
LostFocus="StatusTextBox_LostFocus" GotFocus="StatusTextBox_GotFocus" QueryName="GetStatus"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>​
Hi...I have One More problem in Radgridview Actually When am going to add new item by clicking the add new (+) Button First I enterd some data to first cloumn than am going enter data to second column at this time first column data is not visible like that 3rd & 4th also..but data is saved in db...i want see all the column wat i entered untill click the save button..plz help me as soon as possible
I will try to address the listed inquiries in their original order. If you need any additional help, related to our controls, in the future, I would ask you to open a separate thread for every new question.
- Looking through the provided XAML snippet, I am not sure which element do you want to access. However, you can always use our method ChildrenOfType<FrameworkElement> (that I mentioned in my first post) and find it by name.
- You can use the RegularExpression attribute, to validate the input in the model.
- You have an empty editor, as soon as you start editing, am I right? Can you please verify that the TextBox is properly bound? You can also check for binding expression path errors in the output window.
- You can try the DataLoaded event.
Regards,
Ivan Ivanov
Telerik