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?
Okay, I'm not sure what you are trying to do here. Do you want a CheckBox or a button? If you just want a button, then all you have to do is set the style of the column to Button. You do not have to set the DataType of the column. Leave it at the default, which is string, so that you can apply text to it.
If you want a CheckBox, then you should set the DataType of the column to a Boolean and do not set the Style.
DeletingColumn.CellButtonDisplay = CellButtonDisplay.Always;
DeletingColumn.Width = 45;
uwdList.Bands[0].Columns.Add(DeletingColumn);
//////
Here can change button style only, How can I add text on the button?
please give some sample code.thanks
thanks for your replay.
My mean is, in this column(DeletingColumn), we need button for handle edit/delete event,so our code like above wrote.
this way can add a column with buttons,but I cann't add text on the button.like the image below.Did have any way to do this? if possible, give me some sample code.thanks.
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"; } }
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.
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
You should post this question in the UltraWebGrid forum.
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.