I'm trying to edit a row in a telerik gridview by following your instructions, but when I add the handler definition (this.gridView.AddHandler(GridViewRow.EditEndedEvent, new EventHandler<RecordRoutedEventArgs>(this.OnGridViewRowEditEnded));)
I get the next error:
Telerik.Windows.Controls.RadGridView doesn't contain an AddHandler definition neither We've found an AddHandler definition accepting a first argument with the tipe Telerik.Windows.Controls.RadGridView .
I get the error in spanish and, maybe, the translation it's not as fine as it should, but I'm in a hurry... This is very urgent for me.
Thanks!
13 Answers, 1 is accepted
You need to add using Telerik.Windows;
Please check this demo for more info:
http://demos.telerik.com/silverlight/default.aspx#GridView/Validation
All the best,
Vlad
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I'm very gartefull. In the code-example this reference wasn't included.
Thanks again. ;)
Could you say me when does the event occur? I've put a breakpoint at the function and when I edit a row, the execution never stops at the breakpoint. Whyy?
Thanks!
The RowEditEnded event would fire only if you set RadGridView.ValidationMode to ValidationMode.Row
I have attached a small sample which demonstrates a row by row editing with RadGridView.
Let me know if I can assist you further.
Greetings,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
That's alright, now I can stop at the EndedEdit function, but, I have another problem (sorry!)...
When I edit a cell and press click button in another cell of the same row the "(e.Row).Items[2].Content.ToString()" value gets the updated one; but when a press click in another row after editing, the "(e.Row).Items[2].Content.ToString()" value stays with the old value.
Could you hepl me??
Thanks!
It seems you have hit a bug. Can you please paste me some source code ( or attach a project) for me to see what exactly happens. We are preparing a service pack within two weeks and this can help us a lot to prepare a fix. What I need is the code you use to bind to the grid, the code you use to update data and the type of data you bind to.
A will appreciate your help and will do my best to have the fix included in the service pack for you. If the problem is a show-stopper for you I may think of some workaround meanwhile ( after seing your code).
Please excuse us for the inconvenience caused.
All the best,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
It seems you have hit a bug. Can you please paste me some source code ( or attach a project) for me to see what exactly happens. We are preparing a service pack within two weeks and this can help us a lot to prepare a fix. What I need is the code you use to bind to the grid, the code you use to update data and the type of data you bind to.
A will appreciate your help and will do my best to have the fix included in the service pack for you. If the problem is a show-stopper for you I may think of some workaround meanwhile ( after seing your code).
Please excuse us for the inconvenience caused.
All the best,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Sure! I paste you my code.
- Xaml code:
<Grid x:Name="gridRefCat" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="26"/>
</Grid.ColumnDefinitions>
<gridView:RadGridView x:Name="dgArrendamiento" AutoGenerateColumns="False" Width="Auto" Height="700" CanUserReorderColumns="False" MaxHeight="160">
<gridView:RadGridView.Columns>
<gridView:GridViewDataColumn IsSortable="False" IsReadOnly="False" HeaderText="Referencia Catastral" DataMemberPath="Descripcion" Width="Auto"/>
</gridView:RadGridView.Columns>
</gridView:RadGridView>
- Cs code:
//Constructor
public
DetalleArrendamientoView()
{
InitializeComponent();
this.dgArrendamiento.ValidationMode = ValidationMode.Row;
this.dgArrendamiento.AddHandler(GridViewDataControl.RowEditEndedEvent, new EventHandler<GridViewRowEditEndedEventArgs>(this.OnEditEnded));
}
//Data charge
public void CargaDetalleArrendamiento(DCContrato p_contratoDetalle)
{
if (p_contratoDetalle.ListaConArrendamiento.Count<DCConArrendamiento>() > 0)
{
var q = from contratoD in p_contratoDetalle.ListaConArrendamiento[0].ReferenciaCatastral
select new DatosGridArrendamiento
{
Descripcion = contratoD.Descripcion,
Id = contratoD.Id,
Ruta = GetRuta(contratoD.Estado),
Estado = contratoD.Estado.ToString(),
ForeColor = GetColor(contratoD.Estado)
};
this.dgArrendamiento.ItemsSource = q.ToList();
this.dgArrendamiento.UpdateLayout();
contrato = p_contratoDetalle;
}
else
{
MessageBox.Show("La lista de referencias catastrales est vacia");
}
}
//Update function
private void OnEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
string _texto = string.Empty;
int _indice = (dgArrendamiento.SelectedRecord as DataRecord).DataSourceIndex;
string desc = contrato.ListaConArrendamiento[0].ReferenciaCatastral[_indice].Descripcion;
_texto = (e.Row).Items[2].Content.ToString();
if (desc != (_texto as string))
{
if (contrato.ListaConArrendamiento[0].ReferenciaCatastral[_indice].Estado != 2)
contrato.ListaConArrendamiento[0].ReferenciaCatastral[_indice].Estado = 3;
contrato.ListaConArrendamiento[0].ReferenciaCatastral[_indice].Descripcion = _texto;
}
_indice = -1;
this.dgArrendamiento.Focus();
CargaDetalleArrendamiento(contrato);
}
I hope this helps you!
Thanks for the fast reply
Thnak you very much for the help provided. I have updated your Telerik points. We have fixed the problem and it will definitely included in the service pack (around April/08/2009).
One more time - thank you for the detailed description!
Sincerely yours,
Pavel Pavlov
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I would like to know if you've fixed the editing grid cell's bug.
Thanks
I believe the bug as well as other issues with editing are fixed now with the ServicePack.
Also I would recomend to use the
e.NewData in the Event handler as now it would correctly contain the new values in both cases : CellEditEnded and RowEditEnded.
Regards,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
1 I am trying to run your sample for EDITENDED event and keep gettign following error
Error 1 'Telerik.Windows.Controls.GridView.GridViewCell' does not contain a definition for 'EditEndedEvent' C:\Documents and Settings\jainn7\Desktop\SilverLightDataGridTutorial\CellEdit\118111_silverlightapplication1\SilverlightApplication1\Page.xaml.cs 29 33 SilverlightApplication1
followgin are the refrences in my project
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
System.Windows.Resources;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Data;
using
Telerik.Windows.Controls.GridView;
using
Telerik.Windows.Controls.GridView.Cells;
using
Telerik.Windows;
using
HandlingUnit;
You can download our latest Q1 2009 SP2 from Your Account->Downloads->RadControls for Silverlight.
As for the error you are seeing, RadGridView indeed does not have EditEnded Event. It has CellEditEnded and RowEditEnded. Please if you intend to use the RowEditEnded event , be sure to set RadGridView.ValidationMode = ValidationMode.Row.
Greetings,
Hristo
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
