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

Get CellTemplete from a RadGridView

7 Answers 18 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jahid
Top achievements
Rank 1
Jahid asked on 11 Oct 2018, 12:33 PM

I was trying to use RadMultiColumnComboBox in RadGridView with programatic filtering. The filtered item of the ComboBox(in Col3) is depend on the value of Col1 and Col2. The problem is to get the "Y" object. I donot know how.

<telerik:RadGridView ItemsSource="{Binding X}>
      <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="Col1" DataMemberBinding="{Binding XA}"/>
        <telerik:GridViewDataColumn Header="Col2" DataMemberBinding="{Binding XB}"/>
        <telerik:GridViewDataColumn Header="Col3">
          <telerik:GridViewDataColumn.CellTemplate>
            <DataTemplate>
              <telerik:RadMultiColumnComboBox>
                <telerik:RadMultiColumnComboBox.ItemsSourceProvider>
                  <telerik:GridViewItemsSourceProvider ItemsSource="{Binding Y}" AutoGenerateColumns="False"> (*** used FindAncestor aproach***)
                    <telerik:GridViewItemsSourceProvider.Columns>
                      <telerik:GridViewDataColumn Header="SubCol1" DataMemberBinding="{Binding YA}"/>
                      <telerik:GridViewDataColumn Header="SubCol2" DataMemberBinding="{Binding YB}"/>
                    </telerik:GridViewItemsSourceProvider.Columns>
                  </telerik:GridViewItemsSourceProvider>
                </telerik:RadMultiColumnComboBox.ItemsSourceProvider>
              </telerik:RadMultiColumnComboBox>
            </DataTemplate>
          </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
      </telerik:RadGridView.Columns>
    </telerik:RadGridView>

I tryed following but every time I find null.

-- .ChildrenOfType<>()

-- .Columns["<col_name>"]

-- FindResource() (***as DataTemplete declared as Resource***)

 

     

7 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Oct 2018, 08:27 AM
Hi Jahid,

Thank you for the provided code snippet.

What I can suggest you for this requirement is to use the SelectionChanged event of RadMultiColumnComboBox. The event will be fired each time the user changes the selection through the UI. Please, take a look at the Selection topic for more information. If this approach is not suitable, you can simply fetch the needed property value on data level, rather than trying to access it through the UI.

I hope this helps.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 18 Dec 2018, 06:23 AM
Hello I am getting this error while clicking radmulticombo box item dont know how to correct this please help 
i have set item source programatically 
code is bellow
------------------------
 MultiColumnComboBox.ItemsSourceProvider.ItemsSource = mySalesman.Tables[0].DefaultView; 
0
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 18 Dec 2018, 06:25 AM
<telerik:RadMultiColumnComboBox Name="MultiColumnComboBox" Background="White"  NullText="Select Emplyeee" 
                                            MatchCase="True"
                                            SelectionMode="Single" KeepDropDownOpen="False"
                                            HorizontalAlignment="Left" Margin="1163,131,0,0"
                                            VerticalAlignment="Top" Width="200"  AutoCompleteMode="Suggest"
                                            DropDownMinWidth="{Binding RelativeSource={RelativeSource Self},Path=ActualWdith}"
                                             DropDownWidth="505" DropDownMaxWidth="505" DropDownMinHeight="30"
                                             DropDownHeight="NaN"
                                            DropDownMaxHeight="300"  DisplayMemberPath="first_name">
  
                <telerik:RadMultiColumnComboBox.ItemsSourceProvider>
                    <telerik:GridViewItemsSourceProvider AutoGenerateColumns="False">
                        <telerik:GridViewItemsSourceProvider.Columns>
                            <telerik:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding first_name}" />
                            <telerik:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding Id}" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding emp_id}" />
                            <telerik:GridViewDataColumn Header="Hire Date" DataMemberBinding="{Binding emp_id}" />
                             
                        </telerik:GridViewItemsSourceProvider.Columns>
                    </telerik:GridViewItemsSourceProvider>
                </telerik:RadMultiColumnComboBox.ItemsSourceProvider>
            </telerik:RadMultiColumnComboBox>
0
Stefan
Telerik team
answered on 19 Dec 2018, 04:54 PM
Hello,

For the time being such an exception is not know to us. Can you please provide some more details regarding it? Would it be possible for you to paste the stack trace of the exception, so I can investigate what might be causing it?

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 20 Dec 2018, 06:33 AM
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.RoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseSelectionChangedEvent(SelectionChangeEventArgs args)
   at Telerik.Windows.Controls.DataControl.RaiseSelectionChangedEvent(ItemSelectionChange selectionChange)
   at Telerik.Windows.Controls.DataControl.Telerik.Windows.Data.Selection.ISelectorInternal.RaiseSelectionChangedEvent(ItemSelectionChange selectionChange)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.EndAllowedSelection(ItemSelectionChange selectionChange)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.EndPendingSelection(ItemSelectionChange pendingSelection)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.EndSelection()
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.PerformSelection(Object item, SelectionModificationOptions options)
   at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.PerformRowSelection(Object dataItem, SelectionModificationOptions modificationOptions)
   at Telerik.Windows.Controls.GridView.Selection.CellAndRowSelectionDispatcher.HandleSelectionForValidCellInput(GridViewCell cell, SelectionModificationOptions allowedModifications)
   at Telerik.Windows.Controls.GridView.Selection.CellAndRowSelectionDispatcher.HandleSelectionForCellInput(GridViewCell cell, SelectionModificationOptions allowedModifications)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.HandleMouseDownSelection(GridViewCell cell, Boolean allowDrag, Point mousePosition)
   at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at TrueAccountPOS.App.Main() in C:\Users\hfl\Documents\Visual Studio 2015\Projects\TrueAccountPOS\TrueAccountPOS\obj\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
0
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 20 Dec 2018, 10:12 AM

helloo....the article which you given is not suitable for my requirement...if you don't mind please show me some examples

 

 

0
Stefan
Telerik team
answered on 24 Dec 2018, 03:50 PM
Hi,

Thank you for the provided StackTrace.

This exception seems to be raised by the framework. Thus, I cannot confirm what the exact cause for it might be. Would it be possible for you to demonstrate the error in a sample application and send it to us through a new support ticket? By doing so we will be able to investigate and assist you further. You can take a look at the Isolating a problem in a sample application blog post for further reference.

Thank you in advance for your cooperation.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Jahid
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ras Ran
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or