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

Datatemplate problem

2 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vijay
Top achievements
Rank 1
Vijay asked on 22 Dec 2010, 01:39 PM
Hi

How to get controls from datatemplate column at time of new data add . I am getting row details then try through findname function but not finding the control details

My Code snipped
<telerik:RadGridView >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Width="Auto" >
                        <telerik:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <WrapPanel x:Name="ActionPanel"></WrapPanel>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellTemplate>
                      </telerik:GridViewDataColumn>
                   </telerik:RadGridView.Columns>
        </telerik:RadGridView>

I want find "ActionPanel" at time of click of button for Adding New Data

Thanks
Vijay Kumar

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 23 Dec 2010, 07:58 AM
Hi Vijay,

I assume you are trying to do this within AddingNewDataItem event. This event fires a bit early  - when the data item is added and before the row is rendered visually. That is why you can not access the contents.

As a workaround I may suggest  to try this in the RowLoaded event  instead.

All the best,
Pavel Pavlov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Vijay
Top achievements
Rank 1
answered on 23 Dec 2010, 08:22 AM
Hi Pavel

My Code for seraching is
Dim CurrentRow = e.Row
Dim parentItem = CurrentRow.FindName("ActionPanel")
parentItem = DirectCast(parentItem, System.Windows.Controls.WrapPanel)
I couldnt find this on rowload event .

Trying to bind combo but not getting dropdown list


<telerik:RadGridView ItemsSource="{Binding Employees}" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="10,10,0,0" Name="RadGridView1" VerticalAlignment="Top">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}"  Header="EmployeeID"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" Header="Title"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding BirthDate}" Header="BirthDate"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding MaritalStatus}" Header="MaritalStatus" />
                <telerik:GridViewDataColumn Header="Gender" DataMemberBinding="{Binding Gender}" >
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox Name="ComboBox1" Width="120" ItemsSource="{Binding Gender}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>
               
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
Thanks
Vijay
Tags
GridView
Asked by
Vijay
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Vijay
Top achievements
Rank 1
Share this question
or