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

how to get the display value of a cell on the grid so i can do the popup window edit

4 Answers 205 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tai
Top achievements
Rank 1
Tai asked on 20 Oct 2010, 07:33 PM
Hi

because i don't want to display the financialAccountId on my radgridview, i decide to use the combobox in order to use the display member path "AccountNumber" with selectedvaluepath = "financialAccountId"
However, on my gridview, each row will have an edit button in order to let the user edit it. After clicking on edit, it will popup and a window having a form to let the user modify the value of the fields. My problem right now is that i don't know how to display the original value of the displayed AccountNumber(from the radgridview) on that form because its real bounded value is the financialAccountId

Using a value converter will be out of my option because my Financial account table will have around over 1000000 records

i hope you understand what i am stuck at now. I know there must be a way to retrieve that displayed value. If it is shown on the grid , then its stored value must be somewhere and we can access it


thank you

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 22 Oct 2010, 09:57 AM
Hi Tai,

Please paste me some code , so I can see how do you bind the combo to show the lookup value.
In return I will prepare a small sample app using your code with a popup editor extracting the displayed value in the combo .

Or if you prefer do it yourself, then when showing the popup - you can get the row. Then using the ChildrentOfType extension method (using Telerik.Windows.Controls) , you may find the combo in the row  and read its text property.


Kind regards,
Pavel Pavlov
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
Tai
Top achievements
Rank 1
answered on 22 Oct 2010, 07:49 PM
Hi Pavel,

this is my XAML code. 
thank you for your help

One quick question: because I also want to implement the Search Popup feature for the "Reference Number" column in the gridview. 
The scene is that user has two options for what he can do with that column:
1.if he clicks on that cell column(without modifying anything) and press F2, a popup search screen will appear to let him pick available Reference Number in another reference number gridview.
2.if he clicks on that cell , modify it (still stay in that cell) and press F2, a popup search screen will appear to let him pick filtered (basing on what he types " by using Contains("userTypestring")) reference number in the reference number gridview

For the first scene, i think i can do it but for the second scene. I have no absolute idea to how retrieve what he types in order to call the filtering method and how to update the selected reference number on the reference number gridview back to the original grid at the row of the selected cell. If you can help it, I will be very appreciated. Thank you

 
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:DocumentLine, CreateList=true}" Height="0" LoadedData="documentLineDomainDataSource_LoadedData" Name="documentLineDomainDataSource" LoadingData="documentLineDomainDataSource_LoadingData" QueryName="GetDocumentLinesByIdQuery" Width="0" >
                       <riaControls:DomainDataSource.DomainContext>
                           <my:DocumentLineContext />
                       </riaControls:DomainDataSource.DomainContext>
                       <riaControls:DomainDataSource.QueryParameters>
                           <riaControls:Parameter ParameterName="documentId" x:Name="IdParameter" />
                       </riaControls:DomainDataSource.QueryParameters>
 
                   </riaControls:DomainDataSource>
 
           <StackPanel Orientation="Vertical">
               <telerik:RadButton x:Name="addDocumentLineRBtn" Click="addDocumentLineRBtn_Click" Content="Add document line" Width="113" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0,15,0,0" />
                   <telerik:RadGridView   Name="documentLineRadGridView"
                                           
                               AutoGenerateColumns="False"
                                           
                            IsEnabled="False"
                            ShowGroupPanel="False"
                            CanUserInsertRows="False"
                            DataLoadMode="Asynchronous"
                            RowEditEnded="documentLineRadGridView_RowEditEnded"
                            AddingNewDataItem="documentLineRadGridView_AddingNewDataItem"
                            IsSynchronizedWithCurrentItem="false"
                            Deleted="documentLineRadGridView_Deleted"
                            ShowColumnFooters="True" Height="281" Margin="0">
                       <telerik:RadGridView.Columns>
                            
                       <telerik:GridViewColumn>
                           <telerik:GridViewColumn.CellTemplate>
                               <DataTemplate>
                                   <telerik:RadButton Content="Edit" Click="EditRBtn_Click" Name="EditRBtn"/>
                               </DataTemplate>
                           </telerik:GridViewColumn.CellTemplate>
                       </telerik:GridViewColumn>
 
                       <!--AutocompleteBox radcombobox for the FinancialAccountId-->
                           <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding FinancialAccountId, Mode=TwoWay}" Header="Account"
                                               Width="80"
                                               IsComboBoxEditable="True"
                                               IsFilterable="True"
                                              IsReadOnly="True"
                                               DisplayMemberPath="AccountNumber"
                                               SelectedValueMemberPath="FinancialAccountId"
                                               ItemsSource="{Binding Data, Source={StaticResource v_FinancialAccountSearch}}"
                                               />
                               <!--<telerik:GridViewComboBoxColumn.CellEditTemplate>
                                   <DataTemplate>
                                
 
                               <telerik:RadComboBox ItemsSource="{Binding Data, Source={StaticResource v_FinancialAccountSearch}}"
                                                IsEditable="True"
                                                  
                                                IsFilteringEnabled="True"
                                                GotFocus="RadComboBox_GotFocus"
                                                OpenDropDownOnFocus="True"
                                                TextSearchMode="Contains"
                                                SelectedValue="{Binding FinancialAccountId, Mode=TwoWay}"
                                                SelectedValuePath="FinancialAccountId"
                                                DisplayMemberPath="SearchAccount"
                                               >
                                           <telerik:RadComboBox.ItemsPanel>
                                               <ItemsPanelTemplate>
                                                   <VirtualizingStackPanel />
                                               </ItemsPanelTemplate>
                                           </telerik:RadComboBox.ItemsPanel>
                                       </telerik:RadComboBox>
                                   </DataTemplate>
                               </telerik:GridViewComboBoxColumn.CellEditTemplate>
 
                           </telerik:GridViewComboBoxColumn>-->
 
 
                           <!--AutocompleteBox radcombobox for the FinancialDepartmentId-->
 
 
                           <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding FinancialDepartmentId, Mode=TwoWay}" Header="Department"
                                               IsComboBoxEditable="True"
                                               Width="120"
                                                           IsReadOnly="True"
                                               IsFilterable="True"
                                               DisplayMemberPath="DepartmentNumber"
                                               SelectedValueMemberPath="FinancialDepartmentId"
                                               ItemsSource="{Binding Path=Data,Source={StaticResource v_FinancialDepartmentSearch}}"/>
                               <!--<telerik:GridViewComboBoxColumn.CellEditTemplate>
                                   <DataTemplate>
                               
                               <telerik:RadComboBox ItemsSource="{Binding Path=Data, Source={StaticResource v_FinancialDepartmentSearch}}"
                                                IsEditable="True"
                                                GotFocus="RadComboBox_GotFocus"
                                                 
                                                IsFilteringEnabled="True"
                                                TextSearchMode="Contains"
                                                OpenDropDownOnFocus="True"
                                                SelectedValue="{Binding FinancialDepartmentId,Mode=TwoWay}"
                                               SelectedValuePath="FinancialDepartmentId"
                                                DisplayMemberPath="SearchDepartment"
                                                 
                                                >
                                           <telerik:RadComboBox.ItemsPanel>
                                               <ItemsPanelTemplate>
                                                   <VirtualizingStackPanel />
                                               </ItemsPanelTemplate>
                                           </telerik:RadComboBox.ItemsPanel>
                                       </telerik:RadComboBox>
                                   </DataTemplate>
                               </telerik:GridViewComboBoxColumn.CellEditTemplate>
                           </telerik:GridViewComboBoxColumn>-->
 
 
                           <!--<telerik:GridViewDataColumn DataMemberBinding="{Binding DocumentId, Mode=TwoWay}" Header="Document Id"/>-->
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding ReferenceNumber, Mode=TwoWay}" Header="Reference Number" />
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding TransactionDescription, Mode=TwoWay}" Header="Description" />
                           <!--Transaction Date Header with footer implementation-->
 
 
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding TransactionDate, Mode=TwoWay}" Header="Transaction Date" DataFormatString="{}{0:d}" >
                               <telerik:GridViewDataColumn.Footer>
                                   <StackPanel Orientation="Vertical">
                                       <TextBlock Text="Total:" />
                                       <TextBlock Text="Balance:" />
 
                                   </StackPanel>
                               </telerik:GridViewDataColumn.Footer>
                           </telerik:GridViewDataColumn >
 
 
 
                           <!--Debit Header with footer implementation and AggregateFunctions-->
 
 
                           <telerik:GridViewDataColumn Header="Debit" DataMemberBinding="{Binding DebitAmount, Mode=TwoWay}" DataFormatString="{}{0:c2}">
                               <telerik:GridViewDataColumn.AggregateFunctions>
                                   <telerik:SumFunction SourceField="DebitAmount" ResultFormatString="{}{0:c2}"/>
 
                               </telerik:GridViewDataColumn.AggregateFunctions>
 
                               <telerik:GridViewDataColumn.Footer>
                                   <StackPanel Orientation="Vertical">
 
                                       <telerik:AggregateResultsList ItemsSource="{Binding}"/>
                                       <TextBlock Text=" " />
                                   </StackPanel>
                               </telerik:GridViewDataColumn.Footer>
 
                           </telerik:GridViewDataColumn>
 
 
                           <!--Credit Header with footer implementation and AggregateFunctions-->
 
 
                           <telerik:GridViewDataColumn Header="Credit" DataMemberBinding="{Binding CreditAmount, Mode=TwoWay}" DataFormatString="{}{0:c2}" >
                               <telerik:GridViewDataColumn.AggregateFunctions>
                                   <telerik:SumFunction SourceField="CreditAmount" ResultFormatString="{}{0:c2}"/>
                                   <telerik:SumFunction  SourceField="TransactionAmount" ResultFormatString="{}{0:c2}"/>
                               </telerik:GridViewDataColumn.AggregateFunctions>
                               <telerik:GridViewDataColumn.Footer>
                                   <StackPanel Orientation="Vertical">
 
                                       <telerik:AggregateResultsList x:Name="balance" ItemsSource="{Binding}" />
 
                                   </StackPanel>
                               </telerik:GridViewDataColumn.Footer>
                           </telerik:GridViewDataColumn>
 
 
                       </telerik:RadGridView.Columns>
 
                   </telerik:RadGridView>
0
Accepted
Pavel Pavlov
Telerik team
answered on 27 Oct 2010, 12:28 PM
Hello Tai,

I have prepared a small sample for you , to demonstrate how to get the text form the combo .
Please find it attached .

Pressing F2 while typing text in the combo will display the text typed from the user .

Sincerely yours,
Pavel Pavlov
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
swetha
Top achievements
Rank 1
answered on 20 Nov 2010, 08:18 AM
Hi

i have a telerik grid in silverlight. I want  to display the same telerik grid when i click a checkbox.and the grid should be dynamic means how many times i click the checkbox that many times it should display the grid.

please help me out.

Thanks in advance
Tags
GridView
Asked by
Tai
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Tai
Top achievements
Rank 1
swetha
Top achievements
Rank 1
Share this question
or