Hi,
I have a situation where after user has typed the data in the first column and pressed tab, a query will be performed and the resulting data should fill the rest of the columns.
Col 1 col2
+-----------------|+------------|---------------|--------------------|
12345 & tab Should populate rest
Thanks.
Hello Joy,
Thank you for contacting Infragistics Developer Support.
I am not sure how you bind your data in the grid and how you execute your queries against the data source/data base so I will provide you one of the suggestions that came to my mind.
One of the possible solution in order to get a data from a dataset(or a database) source is to write a LINQ query. Using the value of the first column helps the query to find the rest of the data from the source and attach it to the data source of the UltraGrid. You could find more information about Querying DataSets here:
http://msdn.microsoft.com/en-us/library/bb399358%28v=vs.110%29.aspx
I’ve implemented this suggestion in a simple sample, and you could run and evaluate it, please see attached zip.
Please let me know if my assumptions are wrong, or the suggested implementation is not appropriate for your scenario. Please add more details about the datasouce/database you are using and how you build and execute the query in that is build based on the first column.
Please let me know if you have any further questions.
Hi Atanas, Thanks for your solution. I ran your zipped up app. and it is prtty much what I was looking for thank you very very much. There is one small thing I wanted to ask. Once the row is filled can we move the focus to the new row? Also, the add row seems to contain the last appoinment id, can we also get rid of that?
It seems like in your sample, it is adding a new row. Not appending to the row you just typed the AppoinmentId in.
I am also adding my databinding process.
I have a model PurchaseAdviceWizardDataView I also have a BindingList<PurchaseAdviceWizardDataView>(); I then do this this.gridLoanResult.SetDataBinding(_context.PurchaseAdviceListView, null);
It seems like unless I do the last line in my case I do not get the result view.
Hi Atanas,
Thanks again for your continued support. I think it makes sense to just remove the last active row. It almost seems like the row is getting added by the Ultragird as you start typing to a row and since the its bound to that data and I am gussines it automatically updates it. So, its always in sync with that. It would be great if that worked the other way round, without having to bind it each time. I could be wrong. So, to simplify, since I already know the current index (arow) im just calling the removeat before the add
_context.PurchaseAdviceListView.RemoveAt(currrow);_context.PurchaseAdviceListView.Add(loandata);
It would be nice to have a replace I suppose.
Since the problem I am having now is, if the row with the same num(id) exists, then instead of add, i need to do update.
So, its like this...
User enters the num(id) in the row[curr].col[0], the system checks if this id exists in the db. it then gets the data and populates the rest of the columns for that same row. OK
User enters another num in the next row, system checks if it exists in the current grid, if it exists then remove the row and don't allow the user to enter another of the same. OK
User updates an existing row, system still finds that the num exists (even though its the same row so its an update) it removes it. So, I guess I need to also check if its the same index or not. What is the best way to do that?
The things get more complicated, because, I have a view which is a subset of another model. Which consists of multiple of those views (grouped by batch). This whole thing is mimicking a wizard like view (with next, previous, add etc).
It would be nice, if I would just display the bigger list and simply group by batch number and when user clicks next it increases the filter and shows the next batch. so the user will feel like they are navigating through batches (shows one batch view each time).
Then I don't need this smaller view model and persisting will be easy.
I also was wondering…
Thanks again.
Once you bind a grid to a data source each change of that data source such as adding or deleting items displays in the grid. So, it doesn’t make sense to bind the data source every time you add or delete data from it. Open my sample and notice that the grid is binded just once to the data source. So, could you please modify my sample by adding the data source you bind to the grid? I really need more information about the ‘PurchaseAdviceWizardDataView’ class that you give as a type to your BindingList.
About the update functionality you want to add to your project. As you have already noticed you need to check the index of the row in order to update an existing row. Based on the description you provided I have implemented that functionality in the sample I am sending you. Please see the attached zip.
In order to make a column read only you could use the CellActivation property of the UltraGrid column. More Information could be found here:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=6156
About your second question the event you could use when you tab off from a row is the InitializeRow event. That event fires after the tab is pressed and the rest of the columns are filled with data.
I am sending you the modified sample, and you could run and evaluate it, please see attached zip.
I am waiting for your feedback.
Thanks so much for your reply. I will give a details reply. But, for now I wanted to let you know that you are absolutey correct about the binding. However, I think the updated data is not available (or does not bing with the source) during keydown event. Am I wrong?
The updated data doesn’t need to bind with the source because we have already binded our UltraGrid with the BindingList and thus each data from the list is binded with the grid. So, when we change the id of the row and press TAB the KeyDown event fires and the changes that occur in the row are visualized in the grid.
I hope that this information will help you.
Please do not hesitate to contact me if you have any further question.
Thanks Atanas.
Is there any way I can decoreae my view properties so they don't get added to the grid automatically? What is the best way to handle this?
You have a great weekend!
this.ultraCombo1.SyncWithCurrencyManager = true;
Hope you are doing well.
I am trying to use UltraCombo, which i believe is a part of the grid family. When I used a regular windows combobox I was able to bind it with a BindingList. I also bound few other text controls with that and when I selected new values in the regular combobox it also changed all the values in all other controls that were bound to the same BindingList.
But, when I used the UltraCombo (with multicolums) selecting a row does not change the other controls. What is the way to achive this with UltraCombo?
Thanks for the reply.
Do not hesitate to contact me if you have any additional questions.
Thank you for using Infragistics Components.
Sorry for the long delay. I have been away and just getting back. I think for what you have given me enough to solve the issues I had. I will surely post any updates I may have. Your informations greatly helped.
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?