Hi,
I am getting this strange issue . I have a grid with three columns . The first column is a field name , the next is operator and the last column is condition. Now , i have a button to edit the row . On click of this button , the second column (operator )should turn into a drop down which is happening. Some of the values in the drop down are equals , not equals and includes. Now the initial condition of the row (before click of edit , field = x , oprerator = equals , condtion = y). On click of edit , the second column turns into a dropdown with the current value (which is equals ) selected and the third column turns into a editable user control (here we are using usercontrol - we have done it using the editorcomponent and renderingcomponet of ultracontrolcontainer). Now the problem is , when the screen loads (after the edit click) , the third column which is a usercontrol shows nothing. Only when we click on the cell (of the third column) , it shows the value and when we go out of it (we click the second column cell again) it again becomes blank. How we have used the usercontrol - we have created a user control class say Z with a ultracomboeditor in it . We have created two instances of Z and assigend one each to editorcomponent and rendering component respectively,
Apart from this we have another issue. The usercontrol doesnot fit properly inside the grid column. Please help asap. It would be great if smbdy can include a code example.Thanks
Hi..Can anyone help...a bit urgent..
Hello RC,
Could you please try to attach if possible a small sample project reproducing the above mentioned issue, I will be happy to take a look at it?
If you like, you could give me specific requirements in order for me to create a sample project for you.
How do you want me to proceed with this?
Okay let me restate the requirement so that u can create a sample -1) Create a class named Filter with properties (string field , string operator , string condition)2) Next create a list of the object of this class (List<Filter> listObj ) The object value will be fetched from database . Say , we fetched the value from db and it now has one row (count = 1) and the value of this row is (field = salary , Operator = Eqauls , Condition = 10000). Now this list object is set as a grid's datasource.3) The grid now has three columns in it namely (column 1 = Field , Column 2 = Operator , Column3 = Condition) and has one row with value (field = salary , Operator = Eqauls , Condition = 10000). There is an edit button outside the grid. We click it.4) The second and third column of the selected row becomes editable. 5)The second column now has a ultracomboeditor as its editor component . The values in the ultracomboeditor will be "equals" , and "Includes". Since the vaule of this cell before edit was "equals" , the ultracombo defaults to the value "equals".
5) The third cell (column name - condition with initial value 10000) , has a usercontrol say u1 as its editor component. U1 internally has a ultracomboeditor inside it. The values of this combo will be fetched from db ..ie,,it is not static. Say , values fetched from db are 10000,20000,30000. Since the inital value of the thrid cell was 10000, the combo inside the user control defaults to 10000. Now , the user selects 20000 from this combo and goes out of the grid. The values gets saved in the bound entity .The bound object now has the values (Field = "Salary" , Operator = "Equals" Condtion = "20000")& the entire row returns to its noneditbale normal form
6) if however ,instead of going out from the grid , the user after selecting 20000 from the third cell, chnages the value of the second cell (which is editable with a drop down) to "includes" , the third cell , which is now displaying user control u1 , has to show a different usercontrol say u2 which will internally have a listbox inside it. The items of the list box , just like the combo inside the usercontrol u1 , will be dynamic , ie they will be fetched from db .The value of the listbox defaults to 10000 as it was the original value of the cell. The user can now select other items (multi-select) also from the list box say (20000) and then steps outside the grid. The changes gets saved to the bound list object . The final status of the bound object now (Field = "Salary" , Operator = "Includes" Condtion = "10000,20000")Please help asap
Hi RC,
Creating a sample ourselves probably won't be very helpful. There are too many factors and variables here like what properties you are using and what your UserControl is doing. There are already samples included with NetAdvantage that work correctly. So whatever is happening here has to be something specific to your application.
If you can provide a small sample solution that demonstrates the problem, I am sure we can tell you what's going on. But without that, the situation is just too complex to make any kind of intelligent guess.
Hi Uploaded a dummy attchment. In that
1) when the edit button is clicked , i want the thrid cell's usercontrol to show the value 10000 , also when i click on the first cell , the value should not disappear.2) Currently the usercontrol doesnt fit properly indide the column , it hsould fit properly3) The Ultracombo inside the usercontrol should be editable.
Please help.
Have you looked at any of the UltraControlContainer Samples included with NetAdvantage?
Your sample isn't working, because things are not set up correctly. For one thing, your UserControl needs to interact with the grid using a single property. By default, the UltraControlContainerEditor with use the Value property, or if no such property exists, it falls back to the Text property.
But there is no link between the UltraComboEditor on your UserControl and the Text property of your UserControl. You need to expose a property with a getter and a setter so that the UI get populated. You also need to have your UserControl send notifications when this value changes. You do this by implement the INotifyPropertyChanged interface.
Your EditingControl (the UserControl) does not.
2) The UserControl is sized to the cell. But the UltraComboEditor inside the UserControl is not. You need to dock or anchor the controls inside your UserControl, or handle the Resize event to position the controls within this UserControl how you want them. Right now, it looks like your UltraComboEditor is just docked to the right.
3) This is nothing to do with the UltraControlContainerEditor. It's not editable because the column is not editable. This is because you are setting the CellClickAction to RowSelect and the CellActivation on the column to NoEdit. Your button click is changing the CellClickAction, but not the CellActivation. So you need to do this:
this.grdFilter.DisplayLayout.Bands[0].Columns["Condition"].CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.Edit;this.grdFilter.DisplayLayout.Bands[0].Columns["Condition"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
As I mentioned in one of my earlier replies, there are samples of using UltraControlContainerEditor included in NetAdvantage. If you installed the samples when you installed NetAdvantage, they are already on your hard drive. If not, then you can install them the same way you installed NetAdvantage.
In any case, what you are trying to do here is going to be a little tricky. It's very hard for me to offer you any useful advice without a lot more information, like the structure of your "Filter" object.
The grid in the samples you posted here are not using a custom filter object in the grid cell, they are using a List<T>. So is that what you are actually using? Or is it some custom object?
If all you need are two values, a "to" and a "from" that specify a range, then it would seem to make sense for your grid column to contain a custom object with two properties on it. Using a list is very strange, because a list could have 0, 1, or more items in it, and you are depending on their being only 2. A List will also make things difficult for you because it will be more complicated to track changes to the list, whereas a custom object will be easier to track.
In any case, does it matter to you if the objects are persisted? For example, if the user goes into a cell in the grid and changes the "to" field, but leaves the "from" field alone, does it matter if you change the "form" setting in the existing object as opposed to simply creating a new Filter object with the new properties? I ask, because the latter approach will make things easier for you because setting the grid cell's Value to a new object is something the grid can track, whereas changing a property on an object in the the cell is not.
Hi mike/borris ,
Thansk for your reply. In our app , we are create filters that we need to apply on data. Occasionally we need to edit a filter also.Filter data areloaded within the grid. So for example , salary ranges between 10000 and 20000. If i were to edit this filter , i have to provide user with an environment where he can specify the range. So , for this i need two text boxes , one will have the "from"(10000 for ex) value , the other will have the "to" value (20000) for ex. So showing this two boxes inside a grid column is not possible. In that case we need to wrap them in a usercontrol and show the usercontrol inside the grid. Likewise there are various other requirements as well. If it was associated with a simple dropdown , we would not have used usercontrol in the first place. The problem however is, that , since no simple & downloadable demo of looading a usercontrol grid is avialble on the web , we are just not hitting the right patch. It would be helpful , if you can direct me to a downloadable code example (if any) of loading the usercontrol inside the grid. I looked at the code sample page. But , could not relate certain things as it could not be debugged. If i can get a doenloadable sample , it will be really helpful.
Is what you want a simple dropdown in the cell? Your scenario and project seem to be complex. If you like a software development, code review or implementation planning I can guide you to our Consulting Services Team. Please take a look at the following page, especially at the bottom:
http://ko.infragistics.com/help/support-policies/.
I'm not sure what you are trying to do there, exactly. Since your UserControl has no Value property, the UltraControlContainerEditor is falling back to using Text. But the Text that is being applied here it the Value of the grid cell, which in this case is a list. So... I'm afraid I don't see how that's supposed to work. Are you trying to use the Value in the grid cell as the list to display on the dropdown of your UserControl? If so, then how would the UserControl know which value is currently selected?
I think if you override the Text property on your UserControl and put a breakpoint in the setter for the property, it might make things clearer to you about what's going on here. The value you selected is lost when you leave the cell, because you are not storing that value anywhere.
RC said:Instead of suggesting the chnages , it will be really really helpful , if you can make the changes in this uploaded sample and upload it back from ur side.
For small changes, I'd be happy to do that, and I agree that it would be more helpful. The problem is that the changes that were required here are not small and my time limited. Also, the way you have things set up in this case doesn't really make it clear what you are trying to do, exactly.
So far, it looks like you just want to put a dropdown list in a cell. If that's the case, you are going about it in an extremely over-complicated way. You don't need a ControlContainerEditor for that. Of course, maybe there is more to it and this is just a small sample without the true complexity of your application.
Sorry forgot to attach the code. Attached it now.