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

[Solved] Browser Freezing in Telerik Silverlight Grid

3 Answers 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Humayon
Top achievements
Rank 1
Humayon asked on 10 Dec 2009, 04:37 AM
Hi.

I have a function to insert the data into the Silverlight grid.
We need the current inserted row to be focused row after we Insert a new row. and this row need to be in edit mode.

If we insert the row to the end of the grid, this row need to be scrolled to view when the grid has the scroll bar.

It works fine for the first few times, but after uncertain times, like 8,9 times, or 10,20 times, the whole browser froze.

Please check on this, it is show stopper. We cannot do anything using Telerik Silverlight control if this cannot be fixed.

XAML

<telerikGrid:RadGridView x:Name="grdMarc" IsFilteringAllowed="False" Height="460"   
                                                                    EnableRowVirtualization="True"   
                                                    CanUserResizeColumns="True"  ActionOnLostFocus="CommitEdit" RowIndicatorVisibility="Collapsed"     
                                                    AutoGenerateColumns="False" ColumnsWidthMode="Fill" ScrollMode="RealTime"   
                                                    ShowGroupPanel="False" FontSize="10" ItemsSource="{Binding DataModel.MarcCodeData, Mode=TwoWay}" SelectedItem="{Binding DataModel.SelectedMarcCodeData, Mode=TwoWay}"     
                                                    CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserDeleteRows="False"  >   
                <telerikGrid:RadGridView.Columns>   
                    <telerikGrid:GridViewDataColumn Header="Tag" UniqueName="Tag" DataMemberBinding="{Binding Tag, Mode=TwoWay}" Width="35" IsReadOnly="True"/>    
               <telerikGrid:GridViewDataColumn Header="Ind1" UniqueName="Ind1" DataMemberBinding="{Binding Ind1, Mode=TwoWay}" Width="35" >   
                  <telerikGrid:GridViewDataColumn.CellEditTemplate>   
                     <DataTemplate>   
                        <telerikInput:RadComboBox Loaded="RadComboBox_Loaded" DisplayMemberPath="Text" SelectedValuePath="Value" >   
                        </telerikInput:RadComboBox>   
                     </DataTemplate>   
                  </telerikGrid:GridViewDataColumn.CellEditTemplate>   
               </telerikGrid:GridViewDataColumn>   
               <telerikGrid:GridViewDataColumn Header="Ind2" UniqueName="Ind2" DataMemberBinding="{Binding Ind2, Mode=TwoWay}" Width="45" >   
                  <telerikGrid:GridViewDataColumn.CellEditTemplate>   
                     <DataTemplate>   
                        <telerikInput:RadComboBox Loaded="RadComboBox_Loaded" DisplayMemberPath="Text" SelectedValuePath="Value" >   
                        </telerikInput:RadComboBox>   
                     </DataTemplate>   
                  </telerikGrid:GridViewDataColumn.CellEditTemplate>   
               </telerikGrid:GridViewDataColumn>   
               <telerikGrid:GridViewDataColumn Header="Sub" UniqueName="Subfield" DataMemberBinding="{Binding Subfield, Mode=TwoWay}" Width="45" IsReadOnly="True"/>    
                    
                </telerikGrid:RadGridView.Columns>   
 

C# Code:
New Tag

   string sTag = closeUser.strTag;    
            string strKey = _viewModel.DataModel.NewTag(sTag, true);    
            var Rows = from c in _viewModel.DataModel.MarcCodeData    
                       where c.Key == strKey    
                       select c;    
            if (Rows.Count() > 0)    
            {    
               if (Rows.Count() > 1)    
               {    
                  grdMarc.SelectedItem = Rows.ElementAt(1);    
                  NewFocusRow = Rows.ElementAt(1);    
                  // _viewModel.DataModel.SelectedMarcCodeData = Rows.Last();    
                  //    
               }    
               else   
               {    
                  grdMarc.SelectedItem = Rows.First();    
               }    
   

DataRow Loaded

void grdMarc_RowLoaded(object sender, RowLoadedEventArgs e)    
      {    
         try   
         {    
            if (_viewModel.DataModel.MarcCodeData != null && _viewModel.DataModel.MarcCodeData.Count > 0)    
            {    
               if (e.Row != null)    
               {    
                  IMarcInfo currentItem = e.Row.Item as IMarcInfo;    
                  e.Row.KeyUp += new KeyEventHandler(Row_KeyUp);    
                  foreach (var cell in e.Row.Cells)    
                  {    
                     //cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);    
                     bool wantToolTip = true;    
                     if (Commons.ToInt(currentItem.HideTag) < 10)    
                     {    
                        if (cell.Column.UniqueName != FlexColumn.Tag.ToString() && cell.Column.UniqueName != FlexColumn.Value.ToString())    
                           wantToolTip = false;    
                     }    
                     else   
                     {    
                        if (!string.IsNullOrEmpty(currentItem.Tag))    
                        {    
                           if (cell.Column.UniqueName == FlexColumn.Subfield.ToString() || cell.Column.UniqueName == FlexColumn.Value.ToString())    
                              wantToolTip = false;    
                        }    
                        else   
                        {    
                           if (cell.Column.UniqueName == FlexColumn.Ind1.ToString() || cell.Column.UniqueName == FlexColumn.Ind2.ToString())    
                              wantToolTip = false;    
                        }    
                     }    
                     if (wantToolTip)    
                     {    
                        IscToolTip itemMarcCodeToolTip = new IscToolTip    
                        {    
                           InitialDelay = 0,    
                           ShowDuration = 180,    
                           Content = string.Empty,    
                           InitialElement = cell    
                        };    
                        itemMarcCodeToolTip.Opened += new RoutedEventHandler(itemMarcCodeToolTip_Opened);    
                        IscToolTipService.SetToolTip(cell, itemMarcCodeToolTip);    
                     }    
                     if (cell.Column.UniqueName == FlexColumn.Value.ToString())    
                        cell.KeyUp += new KeyEventHandler(cell_KeyUp);    
                     if (currentItem != null && !string.IsNullOrEmpty(currentItem.Subfield) && cell.Column.UniqueName != FlexColumn.Tag.ToString())    
                        cell.Background = MarcTagHeaderStyleBackground;    
                  }    
                  if (NewFocusRow!=null)    
                  {    
                         
                     if (NewFocusRow.Key == currentItem.Key && NewFocusRow.Subkey == currentItem.Subkey)    
                     {    
                        foreach (var cell in e.Row.Cells)    
                        {    
                           if (cell.Column.UniqueName == FlexColumn.Value.ToString())    
                           {    
                              new System.Threading.Thread(() =>    
                              {    
                                 grdMarc.Dispatcher.BeginInvoke(() =>    
                                 {    
                                    //grdMarc.ScrollIntoView(e.Row, cell.Column);    
                                    (cell as GridViewCell).BeginEdit();    
                                    NewFocusRow = null;    
                                 });    
                              }).Start();    
                           }    
                        }    
                     }    
                  }    
               }    
   
                         }    
         }    
         catch (Exception ex)    
         {    
         }    
      }   
 

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Dec 2009, 07:16 AM
Hi Humayon ,

 Can you post more info about your grid version? Do you have our latest service pack - Q3 SP1?


Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Humayon
Top achievements
Rank 1
answered on 10 Dec 2009, 08:34 AM
 Hi there:
     My version is 2009_3_1127.
     I have tried Q3 SP1, it doesn't work!
     Do you get another solution?
 
0
Humayon
Top achievements
Rank 1
answered on 14 Dec 2009, 01:35 AM
Hi,
This is the Demo and this is zip file,I changed the file type to jpg.
cause I can't upload the zip file this forum.  
asap!
Tags
GridView
Asked by
Humayon
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Humayon
Top achievements
Rank 1
Share this question
or