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

GridView ComboBox Behaving Weird.

2 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 24 Sep 2014, 02:08 PM
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 Answers, 1 is accepted

Sort by
0
Minh
Top achievements
Rank 1
answered on 24 Sep 2014, 02:14 PM
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
0
Dimitrina
Telerik team
answered on 26 Sep 2014, 10:51 AM
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.
 
Tags
GridView
Asked by
Minh
Top achievements
Rank 1
Answers by
Minh
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or