This question is locked. New answers and comments are not allowed.
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.
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