Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Populate the value of a drop down based on a dataset.
posted

Hi

I've use this post for reference:

https://ko.infragistics.com/community/blogs/bf9d3b11-fd1c-4ecd-a46e-dcbd97be1898/archive/2009/05/08/creating-a-dropdown-list-in-a-grid-cell-whose-list-values-are-dependent-on-another-cell.aspx

I want to populate a dropdown (differently for every row based on the value of a dataset or could use a list). When I do what is in the code below it only wipes out all my rows in the grid.  Is there a better/easier way:

    private void UltraGridList_BeforeCellActivate(object sender, CancelableCellEventArgs e)
        {
            if (e.Cell.Column.Key == "FIELD1")
            {
                UltraGridBand rootBand = this.UltraGridList.DisplayLayout.Bands[0];
                //            rootBand.ColumnFilters.ClearAllFilters();
                mDSetPackageDetails = PresentationLogic.GetPackageDescDetails(Convert.ToInt32(UltraGridList.ActiveRow.Cells["FIELD2"].Value), UltraGridList.ActiveRow.Cells["FIELD3"].Value.ToString());
                ValueList valLstPackage = new ValueList();
                foreach (DataRow dRow in mDSetPackageDetails.Tables[0].Rows)
                    valLstPackage.ValueListItems.Add(CheckDBNull.ConvertToString(dRow["FIELD1"]).Trim());
                UltraGridList.DisplayLayout.Bands[0].Columns["FIELD1"].ValueList = valLstPackage;
                rootBand.ColumnFilters["X_SUPRA_DSCNT_ID"].FilterConditions.Add(FilterComparisionOperator.Equals, mDSetPackageDetails);
            }
        }

Parents
  • 21795
    Offline posted

    Hello Tony,

    From the code snippet you provided it seems that mDSetPackageDetails is a DataSet. Is this correct? If so, then the filter you are adding at this line:

    rootBand.ColumnFilters["X_SUPRA_DSCNT_ID"].FilterConditions.Add(FilterComparisionOperator.Equals, mDSetPackageDetails);

    should hide all the rows in the grid, as it is comparing the values in the cells against a DataSet, and I suppose the result is always false. As a first step try to comment out this row and check if the rows are gone again. If the rows are there try to fix your filter.

    Please let me know if you have any additional questions on this matter.

Reply Children