I try to create a custom command ultrawingrid column that includes some ultrabuttons such as "edit button", "delete button", "show detail button"....
I want to add this column to grid at runtime.
I need your urgent help!
I'm not sure what your question is? What part of this is giving you trouble? You can add unbound columns to the grid using the band.Columns.Add method. You would typically do this in the InitializeLayout event. Then you can set the Style of the column to button. If you want text on the buttons, use the InitializeRow event and set the Value of the cell to the text you want.
I try to create some custom columns.
In in the InitializeLayou event of my code is:
band.Columns.Add("Commands", "Action");
colSelect.DataType = typeof(Boolean);UltraGridColumn
colCommand = band.Columns["Commands"];
colCommand.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
colSelect.CellActivation = Activation.AllowEdit;
btnEdit.Text = "Edit";
colCommand.DefaultCellValue = btnEdit;
----
When I run he project and open this gridview, I can not change the checkbox value and I can not see any button in "Command"columns.
I accede any solution for that problem but what I asked above is different. If I want to add two buttons and one combobox in one cell. How can I do it in ultrawingrid?
As I said above, you would set the Value of the cell in the InitializeRow event. Something like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridColumn delColumn = e.Layout.Bands[0].Columns.Add("Del"); delColumn.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button; delColumn.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; } private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Cells.Exists("Del")) { e.Row.Cells["Del"].Value = "Del"; } }
Thanks. It worked
I have a ultrawebgrid user control inside an aspx page. On my ResultGrid on the aspx page, I need to create a ImageButton column which inturn needs to call a javascript function. I looked at Templated columns but could not get them to work. I created a templated column at runtime and implemented as follows:
gResult_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e) {TemplatedColumn t = new TemplatedColumn();t.BaseColumnName = "PROCURE";t.IsBound = true;t.Key = "PROCURE";t.Header.Caption = "Procurement";PlantGrid.gResult.Bands[0].Columns.Add(t);}
void gResult_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) {TemplatedColumn tCol = (TemplatedColumn)e.Row.Cells.FromKey("PROCURE").Column;Infragistics.WebUI.UltraWebGrid.CellItem CI = new CellItem(e.Row.Cells.FromKey("PROCURE"));ImageButton ib = new ImageButton();ib.ID = "imgbtnProcure";ib.ImageUrl = "images/find.gif";CI.Controls.Add(ib);tCol.CellItems[0] = CI;}
This does not work. I am not sure where I am going wrong. Should the Templted Column be implemented in the Usercontrol? Kindly advice.
You should post this question in the UltraWebGrid forum.
Hello Mike,
I have ultraComboBox and UltraGridview on form.
Base on selected value in UltraCombo Box I need to populate or repopulate my ultraGrid. I have one unbounded column which I added using code below.
Problem is whenever change value in UltraCombo, during re-populate process, it fires ultragrid_InitializeLayout Event.
This event try to add column again and ends up throwing exception that "column Exist already ".
Private Sub ultragrid_InitializeLayout(sender As System.Object, e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultragrid.InitializeLayout Dim unboundCol As UltraGridColumn = e.Layout.Bands(ZERO).Columns.Add("Command Col") unboundCol.Style = ColumnStyle.Button unboundCol.ButtonDisplayStyle = ButtonDisplayStyle.Always unboundCol.Header.VisiblePosition = 3End Sub
What the better way to code this scenario?
Thanks
Imran
Mike,
Thanks for your help.
It works for me.
Thanks,
EEmran
Hi,
All you have to do is check e.Layout.Bands(ZERO).Columns.Exists("Command Col") to see if the column is already there before you try to add it.