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

Issue with Cell validation

5 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sulagna
Top achievements
Rank 1
sulagna asked on 13 Jan 2011, 01:14 PM
Hi,
One issue I am facing in Cell validating.i.e when I change the cell value from current to closed it should allow the user to do any action after showing one alert but I am not able to save or do any thing.If I make IsValid true then also it restrict.
                   if (e.NewValue != null)
                    {
                        //Making current iteration closed
                        if (e.NewValue.ToString() == LeMonNextResource.IterationClosedStatusID)
                        {
                            MessageBox.Show("Once you close an iteration, You won't be able to make further changes to it." +
                                    "\n" + "Are you sure, You want to continue?");                            
                            if (MessageBoxButton.OK == 0)
                            e.IsValid = false; 
                        }
}
Should I write this inside GridViewComboBox selection change event?I tried with this but I am not getting SelectionChangedEvent.
Is this "RadComboBox" the name of GridViewComboBoxColumn?
this.RadGridView1.AddHandler(RadComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(OnSelectionChanged));
 
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    // TODO: Implement this method
    throw new NotImplementedException();
}
My xaml is
    <telerik:GridViewComboBoxColumn  x:Name="ComboBox"
                                            DataMemberBinding="{Binding IterationStatusID,Mode=TwoWay}"
                                            SelectedValueMemberPath="IterationStatusId"
                                            DisplayMemberPath="IterationStatusName" 
                                            UniqueName="IterationStatus" Width="80"
                                            IsResizable="False" ItemsSource="{Binding Path = StatusList,Mode=TwoWay}"                 
                                            HeaderCellStyle="{StaticResource CustomHeaderCellStyle}"                                           
                                            CellTemplate="{StaticResource StatusComboBoxSelectionBoxTemplate}"/>
 
Regards,
Sulagna            

5 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 13 Jan 2011, 05:06 PM
Hi sulagna,

I am not sure that I have understood the problem correctly so please correct me if I am wrong. As far as I can understand you would like to be able to perform other actions even though there is a validation error. If that is the case you can try setting the ActionOnLostFocus property to None. 


Kind regards,
Milan
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
sulagna
Top achievements
Rank 1
answered on 14 Jan 2011, 07:12 AM
Hi Milan,

When the user changes the iteration from current to closed it should change the combobox item to close & allow the user to do any kind of action after displaying one alert.But what its doing is its changing the combo box item to Current it should retain Closed state.
I tried CellEditEnded event also but here also I am facing the same issue.This is happing in CellEditEnded as well as CellValidating both. In CellValidating if I make  e.IsValid = false; then it changes the value to Closed but restricts the user to proceed.

Thanks,
Sulagna
0
Nedyalko Nikolov
Telerik team
answered on 19 Jan 2011, 04:01 PM
Hello sulagna,

As I understand you want to prevent user input of a specific item when value of the "Status" column is "Closed".
If this is your goal you don't need validation, just show a message box when cell exits edit mode (CellEditEnded event). In order to prevent user from editing any other cell inside row which item.Status == Closed, you could use ReadOnlyBinding property for more information you can take a look at this help topic.

Regards,
Nedyalko Nikolov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Arminder
Top achievements
Rank 1
answered on 22 Nov 2012, 07:31 AM
Hello Nedyalko,

I am using Silverlight RadGridView control and i have implemented CellValidating event to validate the information. From CellValidating event if i set e.IsValid=true then we are able to move to next cell or row and there is no any error message is showing and it is working as per my requirement. Now if i set e.IsValid = false then it shows error message and not allowing me to move to any other cell or Row in same grid. But i reqired to show error message and also move to other cells or row of the grid.

Please help me to achieve the above.

Thanks
Arminder Singh
0
Nedyalko Nikolov
Telerik team
answered on 27 Nov 2012, 07:00 AM
Hello,

You could use RowValidating event instead. That way you will be able to edit any cell in the row and validate it when row edit is finished.

Greetings,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
sulagna
Top achievements
Rank 1
Answers by
Milan
Telerik team
sulagna
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Arminder
Top achievements
Rank 1
Share this question
or