UltraWinGrid does not display UltraCombo or allow modifying row

UltraWinGrid does not display UltraCombo or allow modifying row

Old forum URL: forums.lhotka.net/forums/t/2959.aspx


closl posted on Wednesday, May 30, 2007

I'm new to UltraWinGrid (Infragistics).  We're using CSLA v 1.5.  I'm able to display data, but unable to modify it or display the UltraCombo in one of the columns.  Any insight?

ajj3085 replied on Wednesday, May 30, 2007

First, be sure to set the grid to allow edits, inserts and deletes. 

Second, the combo is a bit of a pain.. you need to create a list to give it the values to display, but you can't do this via the designer.

Here's a snippit of my code that does what you will need to do..

            ValueList typeValues;
       
            /* Phone types */
            typeValues =
                PhoneNumbersGridView.DisplayLayout.ValueLists.Add(
                    Guid.NewGuid().ToString()
                );
            foreach ( PhoneTypeList.NameValuePair nv in PhoneTypeList.List ) {
                typeValues.ValueListItems.Add( nv.Value );
            }
            PhoneNumbersGridView.DisplayLayout.Bands[ 0 ].Columns[
                "PhoneType" ].ValueList = typeValues;

PhoneTypeList is a Csla.NVL .  The static List property is simply a cached list.  "PhoneType" is the name of the column which should have the dropdown.  ValueList is a Infragistics class.

I call this code as the form is loading.

HTH
Andy

closl replied on Wednesday, May 30, 2007

Thanks for responding.  I'm sorry to say that it's still not working.  Below is the code I have.  Maybe a new pair of eyes will see something.  My grid is on a user control and it's contents are gathered when the Orders property is set.

public partial class UC_OrderPayers : Starkey.ProHear.UI.PHNControls.PHNUniverseControl

{

private OrderPayersCollection m_orderPayers = null;

private InsuranceClaimStatusReadOnlyCollection m_claimStatus = null;

private Orders m_orders = null;

private ValueList claimStatusValueList;

public UC_OrderPayers()

{

InitializeComponent();

claimStatusValueList = new ValueList();

}

#region Properties

public Orders Orders

{

get { return m_orders; }

set

{

m_orders = value;

if (m_orders != null)

{

GetPolicyList(m_orders.PatientKey);

}

}

}

#endregion

private void GetPolicyList(Patient.Key patientKey)

{

m_orderPayers = OrderPayersCollection.RetrieveAll(Orders.Key.EmptyKey, m_orders.PatientKey);

m_claimStatus = InsuranceClaimStatusReadOnlyCollection.RetrieveAll();

grdPayers.DataSource = m_orderPayers;

foreach (InsuranceClaimStatus ics in m_claimStatus)

{

claimStatusValueList.ValueListItems.Add(ics);

}

}

private void grdPayers_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)

{

if (!object.ReferenceEquals(this.grdPayers.DisplayLayout.Bands[0].Columns[0], null))

{

e.Layout.Bands[0].Override.AllowUpdate = DefaultableBoolean.True;

e.Layout.Bands[0].Override.AllowDelete = DefaultableBoolean.True;

e.Layout.Bands[0].Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.Yes;

e.Layout.Bands[0].Columns["InsuranceClaimStatusID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;

e.Layout.Bands[0].Columns["InsuranceClaimStatusID"].ValueList = claimStatusValueList;

e.Layout.Bands[0].Columns[0].Hidden = true;

e.Layout.Bands[0].Columns[1].Hidden = true;

e.Layout.Bands[0].Columns[2].Hidden = true;

e.Layout.Bands[0].Columns[4].Hidden = true;

e.Layout.Bands[0].Columns[5].Hidden = true;

e.Layout.Bands[0].ColumnsDevil [6].Hidden = true;

e.Layout.Bands[0].Columns[7].Hidden = true;

e.Layout.Bands[0].ColumnsMusic [8].Hidden = true;

e.Layout.Bands[0].Columns[10].Hidden = true;

e.Layout.Bands[0].Columns[11].Hidden = true;

e.Layout.Bands[0].Columns[12].Hidden = true;

e.Layout.Bands[0].Columns[13].Hidden = true;

e.Layout.Bands[0].Columns[14].Hidden = true;

e.Layout.Bands[0].Columns[15].Hidden = true;

e.Layout.Bands[0].Columns[16].Hidden = true;

e.Layout.Bands[0].Columns[18].Hidden = true;

e.Layout.Bands[0].Columns[19].Hidden = true;

e.Layout.Bands[0].Columns[20].Hidden = true;

}

}

}

ajj3085 replied on Thursday, May 31, 2007

Please note my original code, specifically this line:

typeValues =
                PhoneNumbersGridView.DisplayLayout.ValueLists.Add(
                    Guid.NewGuid().ToString()
                );

Notice that i'm not creating an empty value list via its constructor, I'm using the ValueLists collection on DisplayLayout to create it.


I don't see anywhere that you add claimStatusValueList to grid.DisplayLayout.ValueLists.. this may be your problem.

closl replied on Thursday, May 31, 2007

At the risk of sounding like a total moron, I do not have the object "ValueLists" off of the DisplayLayout"  I do find it off of the column and it is a singular noun vs. ValueLists, which is plural

See my code is in InitializeLayout event: 

e.Layout.Bands[0].Columns["InsuranceClaimStatusID"].ValueList = claimStatusValueList;

your code: 

typeValues = PhoneNumbersGridView.DisplayLayout.ValueLists

but still, it does not show. 

Are you using a different control by chance or a different version of Infragistics.  We're using the latest.

Thanks...

ajj3085 replied on Thursday, May 31, 2007

Well, I also set the ValueList off of the column, but that's in addition to adding to the DisplayLayout.ValueLists collection.

I'm using NA 20071, although I think I first implemented this code in 20062. 

The control is Infragistics.Win.UltraWinGrid.UltraGrid.

kamanova replied on Thursday, May 31, 2007

I just started working with CSLA and Infragistics two months ago, so I don't know if there is a better way to do this or not, but I have been using the EditorControl property.

If you are using a NameValueList bo, add an UltraComboEditor control to the form your grid is on. Otherwise use an UltraCombo control instead. (The UltraCombo is basically a dropdown UltraWinGrid.)

Set the visibility of any controls you added to false.

Open the UltraWinGrid Designer and click on Band and Column Settings->Band[0]...->Columns.

Select the column you want the combo on, look for the EditorControl property, and select the control you added above from the dropdown list.

That is all there is to it. As long as the control is bound correctly and you set the binding source's datasource at runtime, it should work fine. This way you don't need to mess with the wingrid through code at all.

Hope that helps!

ajj3085 replied on Thursday, May 31, 2007

So using your method, are you actually embedding another infragistics control into the column?  I had simply used the style property of the column and set it to dropdown or something like that.  Perhaps that's where the OP and I have been miscommunicating.. if he's embedding another control, I don't think my code applies.

Copyright (c) Marimer LLC