RadDataPager issue selected page index...

4 posts, 0 answers
  1. Karthik
    Karthik avatar
    10 posts
    Member since:
    Jul 2012

    Posted 26 May 2013 Link to this post

    Hello 
    I am using telerik rad controls for developing a silverlight 4 application. I am working on some thing like this, when a user edits a cell in radgridview and try to go to next page without saving the edited item (fig pagerintial.png), I am poping up a  warning msg saying that, "Ok"  buttonto cancel edited items and go to next page or "Cancel" button to stay on the current page(fig pagerwarningmsg.png).

    I have a problem when hitting "Cancel" button, I am staying on the current page which is fine, but the raddatapager is displaying the new page index(fig pagererror.png).can anyone help me out with this issue, please refer the images and code below.

    <telerik:RadDataPager x:Name="OrderPager"
                                            Grid.Row="2"
                                            Grid.Column="0"
                                            Source="{Binding PagedCollectionView, Source={StaticResource PFOViewModel}}"
                                            IsTotalItemCountFixed="False"
                                            DisplayMode="FirstLastPreviousNextNumeric, Text"
                                            telerik:StyleManager.Theme="Summer"
                                            PageIndexChanging="OrderPager_PageIndexChanging" PageSize="{Binding PageSize}" 
                                            PageIndexChanged="OrderPager_PageIndexChanged" 
                                            NumericButtonCount="10" />
     
    private void OrderPager_PageIndexChanging(object sender, Telerik.Windows.Controls.PageIndexChangingEventArgs e)
          {
              // We set this to true, that way the load method knows to keep our selections.
              // If this wasn't set then we would think it is a new set of filters so we should clear the selections
              pfoViewModel.IsPaging = true;
          }

     
    private void OrderPager_PageIndexChanged(object sender, PageIndexChangedEventArgs e)
            {
                if (IsDirty == true && addedItems != null)
                {
                    TextBlock tb = new TextBlock();
                    tb.TextWrapping = TextWrapping.Wrap;
                    tb.Height = 100;
                    tb.Width = 250;
                    tb.Text = ApplicationStrings.SaveDatatMsg;
                    tb.FontSize = 12;
                    tb.FontFamily = new System.Windows.Media.FontFamily("Verdana");
     
                    //Pop Up Dialog
                    Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters();
                    parameters.Header = ApplicationStrings.SaveDataWarningCaption;
                    parameters.Content = tb;
                    parameters.Theme = new Telerik.Windows.Controls.SummerTheme();
                    parameters.OkButtonContent = ApplicationStrings.OKButton;
                    parameters.CancelButtonContent = ApplicationStrings.CancelButton;
     
                    parameters.Closed = (sender1, e1) =>
                    {
                        IsDirty = false;
                        if (e1.DialogResult != null && e1.DialogResult.Value == true)
                        {
                            pfoViewModel.RejectChanges();
                            grdProducts.CancelEdit();
                            addedItems.Clear();
                            //Perform the Paging Operation
                            pfoViewModel.Page = e.NewPageIndex;
                        }
                        else
                        {
                            pfoViewModel.IsPaging = false;
                            pfoViewModel.Page = e.OldPageIndex;
                        }
                    };
     
                    Telerik.Windows.Controls.RadWindow.Confirm(parameters);
                }
                else
                {
                // Change the data to the next page of data...
                pfoViewModel.Page = e.NewPageIndex;
                // pfoViewModel.IsPaging = false;
                }
            }
      
     public int Page
            {
                get { return pageCurrent; }
                set
                {
                    if (pageCurrent == value)
                        return;
     
                    pageCurrent = value;
                    RaisePropertyChanged("Page");
                    // Re-load...
                    RefreshRecords();
                }
            }
            private int pageCurrent = 0;  // Default
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 27 May 2013 Link to this post

    Hi,

    Maybe you should use the PageIndexChanging event which cancelable?

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Karthik
    Karthik avatar
    10 posts
    Member since:
    Jul 2012

    Posted 28 May 2013 Link to this post

    Yeah, I tried that but before I even hit cancel button the pageindexchanged event is firing...
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 29 May 2013 Link to this post

    Hello,

    That is really strange and unexpected. Can you please open a new support ticket from your licensed Telerik account and send us a dummy project that demonstrates this behavior. We will take a look. Thanks in advance.

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top