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
2320
Want DropDownList in Column to 'always' display in grid
posted

I'm setting up a UltraWebGrid.  I got a DropDownList setup in a column.  The DropDownList will only display when I select the cell and try to edit it.  How can I get the DropDownList to display always?

In the UltraWinGrid I would set the

Column.ButtonDisplayStyle = ButtonDisplayStyle.Always; 

How do I accomplish this with an UltraWebGrid?  I tried doing it like this....

 col = gridTransaction.Columns.FromKey("ColumnName");
 col.Header.Caption = "Primary Item Field";
 col.Header.Style.HorizontalAlign = HorizontalAlign.Center;
 col.ServerOnly = false;
 col.Width = Unit.Pixel(110);
 col.Move(3);
 col.Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList; 
 col.DataType = "System.Int32";
 col.ValueList.DataSource = _dataSet;
 col.ValueList.DataMember = "tablename";
 col.ValueList.DisplayMember = "ColumnName";
 col.ValueList.ValueMember = "ColumnName";
 col.ValueList.DataBind();

This code does exactly what I need, except I want the DropDownList to always display, so I added...

col.CellButtonDisplay = CellButtonDisplay.Always;

But this doesn't seem to have any effect.

What am I missing or how do I get the DropDownList to always appear in the cell?

       

  • 260
    posted

    You probably found the answer by now, but I post this if others come accross the same problem.

    I just spent the last hour trying to figure out why I couldn't do this.  I had 2 columns that I needed a ValueList for.  Neither would display the text value, but would "stick" once I changed the value in the dropdown.  It seems my value lists didn't understand what TinyInt or Numeric data types were.  Once I changed the database to Int, the value list was happy.

    The lines I ended up using were: 

    grd.Columns(0).

     

    ValueList = vlType
    grd.Columns(0).
    Type = ColumnType.DropDownList

  • 19308
    Verified Answer
    posted

    The WebGrid doesn't allow you to do this by default.  When dealing with a web application, performance and total markup size become critical.  If you put the same copy of a dropdown control in each cell in a column, it adds significant weight.  The grid actually has a pretty sophisticated mechanism to re-use a single dropdown in each cell.  The constraint is that a single control can't be in 2 places at once.  If you really need to have a dropdown present in each cell, I would recommend using a TemplateColumn, and placing a dropdown/webcombo inside of the cell template. 

    Hope this helps,

    -Tony