Issue with Cell validation

6 posts, 0 answers
  1. sulagna
    sulagna avatar
    56 posts
    Member since:
    Sep 2010

    Posted 13 Jan 2011 Link to this post

    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            
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 13 Jan 2011 Link to this post

    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>>
  3. sulagna
    sulagna avatar
    56 posts
    Member since:
    Sep 2010

    Posted 14 Jan 2011 Link to this post

    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
  4. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 19 Jan 2011 Link to this post

    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>>
  5. Arminder
    Arminder avatar
    6 posts
    Member since:
    Aug 2012

    Posted 22 Nov 2012 Link to this post

    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
  6. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 27 Nov 2012 Link to this post

    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.

Back to Top