GridView ComboBox Behaving Weird.

3 posts, 0 answers
  1. Minh
    Minh avatar
    43 posts
    Member since:
    May 2014

    Posted 24 Sep 2014 Link to this post

    Hello,

    So I have a GridView in which I can add new rows and within the columns I can select some combo boxes and a date Picker.

    This is how it looks before anything is changed


    When I change one row at a time and click save it works, the problem is when I multiple rows and combo boxes and I don't click away From the Final Combo Box. It doesn't register the Final Combo Box changed. Pictures below will illustrate what's happening.


    Notice the second "Maintained" is currently showing within a combobox, that means it won't register the change until it's clicked away.


    You can see here that after the save button is clicked, it reverts back to the value it was before because it wasn't "Registered"



    But if I click away such that the ComboBox stops appearing and click save, it works. Image Below.


    May I ask How to fix this? 




































  2. Minh
    Minh avatar
    43 posts
    Member since:
    May 2014

    Posted 24 Sep 2014 in reply to Minh Link to this post

    Reposting with Pictures that wasn't brought over...

    So I have a GridView in which I can add new rows and within the columns I can select some combo boxes and a date Picker.

    This is how it looks before anything is changed

    http://snag.gy/YLtij.jpg

    When I change one row at a time and click save it works, the problem is when I multiple rows and combo boxes and I don't click away From the Final Combo Box. It doesn't register the Final Combo Box changed. Pictures below will illustrate what's happening.


    Notice the second "Maintained" is currently showing within a combobox, that means it won't register the change until it's clicked away.



    You can see here that after the save button is clicked, it reverts back to the value it was before because it wasn't "Registered"

    http://snag.gy/AuWCM.jpg

    But if I click away such that the ComboBox stops appearing and click save, it works. Image Below.

    http://snag.gy/2Ghui.jpg

    May I ask How to fix this? s
  3. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Sep 2014 Link to this post

    Hello,

    I am not able to open the following two images:
    http://snag.gy/YLtij.jpg
    http://snag.gy/2Ghui.jpg.

    Generally, RadGridView will not be aware of the modification you do in its editor until the edit is committed. Looking at the http://snag.gy/AuWCM.jpg image, it seems you never enter edit mode as you have placed the RadComboBox as a CellTemplate for the column.
    In that case, you say the value will be updated as you loose focus. I can suggest you subscribing for the SelectionChanged event of RadComboBox and invoke all the modifications you need right after the selected value has changed.
    For example:
    private void RadComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
     {
     // Must be a RadComboBox
      if (e.OriginalSource is RadComboBox)
      {
          // Get it and find the parent column
          var comboBox = (RadComboBox)e.OriginalSource;    
       
          if (e.AddedItems.Count > 0)
          {
              // your code
          }
      }
    }

    I hope this helps.

    Regards,
    Dimitrina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top