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
555
Adding drop down style In Infragistics grid not working
posted

Hi,

Column Style in Infragistics is not working specifically for DropdownList and DropDown.

Please review my code and anyone help me.

public partial class Form6 : Form

{

public Form6()

{

InitializeComponent();

}

private DataTable GetGridData(int rows)

{

DataTable dtData = new DataTable();

dtData.Columns.Add("Col_1");

for (int i = 1; i <= rows; i++)

{

DataRow dr = dtData.NewRow();dr["Col_1"] = "test";

dtData.Rows.Add(dr);

}

dtData.AcceptChanges();

return dtData;

}

private DataTable GetGridData()

{

return this.GetGridData(2);

}

private void Form6_Load(object sender, EventArgs e)

{

DataTable dt = GetGridData();

this.ultraGrid1.DataSource = dt;

ultraGrid1.DisplayLayout.Bands[0].Columns["Col_1"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;

 

//UltraComboEditor myComboEditor = new UltraComboEditor();

//myComboEditor.DropDownStyle = DropDownStyle.DropDownList;

//myComboEditor.Items.Add(new ValueListItem("Key1", "Value1"));

//ultraGrid1.DisplayLayout.Bands[0].Columns[0].EditorControl = myComboEditor;

}

}

 My designer code:

this.ultraGrid1.Location = new System.Drawing.Point(-2, 33);

this.ultraGrid1.Name = "ultraGrid1";

this.ultraGrid1.Size = new System.Drawing.Size(531, 498); this.ultraGrid1.TabIndex = 0;

this.ultraGrid1.Text = "ultraGrid1";

 Dropdown in gridThe cell is editable even after i set the style to DropDownList ..

Parents
No Data
Reply
  • 2334
    posted

    You need to set the ValueList property of the column.  The grid will use teh value list items as the items in the drop down.  You should do this and any other initialization in the IntializeLayout event of the grid.

    private void grid_InitializeLayout(object sender, InitializeLayoutEventArgs e) {

    ValueList = new ValueList();

    // add value list items

     e.Layout.Bands[0].Columns["Col_1"].ValueList = vl;

    }

Children