Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Use UltraDropDown to fill multiple cells in an UltraGrid

Use UltraDropDown to fill multiple cells in an UltraGrid

New Discussion
Joe_D
Joe_D asked on Nov 19, 2019 10:28 PM

Hello,

I’m new to Infragistics and am trying to add onto an existing WinForms App.  Using the below article I am able to populate an UltraDropDown from a DataTable, and bind it to the first cell of an UltraGrid.  All four columns of the DataTable display in the DropDown.  After a BtnOnClick for AddNew Row I can select from the UltraDropDown, but it will only fill the first column of the row.  I want to to use the rest of the columns in the UltraDropDown to fill other columns in the UltraGrid.  How can I do that?  Is there a better means to accomplish what I want to do than an UltraDropDown?

https://www.infragistics.com/community/product_platforms/winforms/w/winforms-wiki/3/best-practices-for-placing-a-dropdown-or-combo-in-an-wingrid-cell

Here is my code:

private void ugChargebacks_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Columns[“ClaimsProviderAmountsId”].Hidden = true;
e.Layout.Bands[0].Columns[“Custno”].Hidden = false;
e.Layout.Bands[0].Columns[“Subno”].Hidden = false;
e.Layout.Bands[0].Columns[“IDno”].Hidden = true;
e.Layout.Bands[0].Columns[“Amount”].Format = “C”;

UltraDropDown agentDropDown = new UltraDropDown();
agentDropDown.DataSource = _diag.InspectionFeeInfo.agentList;
Controls.Add(agentDropDown);
agentDropDown.SetDataBinding(_diag.InspectionFeeInfo.agentList, null);
agentDropDown.ValueMember = “Type”;
agentDropDown.DisplayMember = “Custno”;

e.Layout.Bands[0].Columns[“Custno”].ValueList = agentDropDown;
}

private void btnAddChageback_Click(object sender, EventArgs e)
{
UltraGridRow row = ugChargebacks.DisplayLayout.Bands[0].AddNew();
}

Sign In to post a reply

Replies

  • 0
    Michael DiFilippo
    Michael DiFilippo answered on Nov 18, 2019 9:56 PM

    Hello Joe, 

    Thank you for contacting Infragistics. Please provide a mockup/screenshot of your desired behavior. Are you trying to place an UltraDropDown in the add new row too?

    "After a BtnOnClick for AddNew Row I can select from the UltraDropDown, but it will only fill the first column of the row.  I want to to use the rest of the columns in the UltraDropDown to fill other columns in the UltraGrid."

    Not sure I follow exactly what you mean. 

    You would need to assign a dropdown to every ValueList for each column in the grid you wish to have.

    • 0
      Joe_D
      Joe_D answered on Nov 18, 2019 10:12 PM

      Hi Mike,

      Thanks for the quick response.  Multiple drop downs would be bad in this case as it could lead to errors in data entry.  Currently the drop down will only fill the Custno filed.  I want all the data from the selected row to fill all relevant fields  (subno and agent) as well.  See below.

      Thanks,

      Joe

      • 0
        Mike Saltzman
        Mike Saltzman answered on Nov 19, 2019 2:13 PM

        Isn't that kind'v redundant? You will be storing a lot of the same data twice – once in the dropdown table, which is essentially a lookup and then again in the grid. And that means if something in the lookup table changes, the grid data will be out of synch. 

        It seems to me that a better way to do this would be to simply disable editing on the other fields in the grid and then use the grid's InitializeRow event to get the current CustNo and pull out the other data to populate the grid fields for display. 

        Of course, you might also want to do the same thing in the CellChange event so you can track when the CustNo changes immediately when user makes a selection from the dropdown. 

      • 0
        Joe_D
        Joe_D answered on Nov 19, 2019 3:07 PM

        Thanks Mike,

        My Manger also had time to work with me on this and he also used an event to populate the rest of the grid.  I thought I was missing something in the data binding that was preventing the grid from being populated. That was a deep rabbit hole unfortunately.

        You bring up an interesting point about the data in the drop down but in this business case it is historical data and would not change.  It is worth considering in in other cases though.

        I really appreciate the assistance!

        Thanks,

        Joe

      • 0
        Mike Saltzman
        Mike Saltzman answered on Nov 19, 2019 6:57 PM

        If it's historical data that does not change, then why would you be changing the CustNo? 
        It sounds to me like you just want to display the information for a particular customer. In which case, the grid probably isn't the right control to use for that. The grid is intended to display lists of data with multiple rows. If you just want to show a single row of data, then a grid is an odd choice for that. 

      • 0
        Joe_D
        Joe_D answered on Nov 19, 2019 7:23 PM

        This form is for entering charges to a customer (Amount field).  There may be existing charges that will populate the grid.  The intent is not to change the custno but to populate a new row with the custno/subno and agent (name) of the customer to be charged in that row and then assign an charge amount.

        You raise a good point that I should set any existing charges entered into the grid to read only / non-editable.

        Based on your previous suggestion I disabled editing on the other columns using:

        e.Layout.Bands[0].Columns[“var”].CellActivation = Activation.NoEdit;

        and just used the events to write those values.

      • 0
        Michael DiFilippo
        Michael DiFilippo answered on Nov 19, 2019 10:28 PM

        Thank you for your feedback. Let us know if you have any additional questions. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Joe_D
Favorites
0
Replies
7
Created On
Nov 19, 2019
Last Post
6 years, 11 months ago

Suggested Discussions

Created by

Created on

Nov 19, 2019 10:28 PM

Last activity on

Feb 20, 2026 1:10 PM