Hi All,
I am very new to infragistic control. I have a requirement to load data from data table to Ultra Win Grid. When I add the data table to grid then grid is loading the entire data from the data table. I want to customize the column like follows1. I need to modify the column name and show less number of columns in the grid2. I need to place drop down list in cell3. I need to place combo box in cell4. I need to invoke event for drop down list and check box based on their selection5. I need to place a button control and add its caption need to load from one of the data table column value6. How will I create grid event from the designer
For ExData TableAccount_Holder - I want to show header as Account Holder NameBank_Name - I want to show header as Bank NamePath - I want to place a button control in cell and display value from the column Path and hide the column PathStatus - Drop down list and based on the selection event call some calculationVerified - Check box and based on its event I need to persofrm some calculation
Please give me an idea how can I achieve above task.
ThanksSelvakumar R
Hello Selvakumar,
You can change a column’s name by setting the column’s header caption property.
You can hide individual columns in the grid by setting the hidden property of the column. The example below hides ‘Bank_Name’ column in first band.
For the DropDownList you can use the UltraDropDown control, bind the DataSource object and assign it to a cell’s ValueList. The UltraCombo should be assigned to the EditroComponent of the cell.
For the DropDown you can handle the RowSelected event, which is fired when a new row of the dropdown is selected.
Regarding the Checkbox column, you have to handle the grid’s CellChange event. If you need to get the cell value inside this event, you must use the Text property of the cell, because Value does not get updated until the user leaves the cell and the change is committed.
To place a button in a grid’s cell, set the cell’s Style property to Infragistics.Win.UltraWinGrid.ColumnStyle.Button.
To create an event handler, you have to select the control that you want to create an event handler for, click the Events button in the Properties window and double click the event that you want to create an event handler for in the events list.
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
//Change Column Name
e.Layout.Bands[0].Columns["Account_Holder"].Header.Caption = "Account Holder Name";
e.Layout.Bands[0].Columns["Bank_Name"].Header.Caption = "Bank Name";
//Hide a column
e.Layout.Bands[0].Columns["Bank_Name"].Hidden = true;
//Assign UltraDropDown To Cell
e.Layout.Rows[0].Cells[0].ValueList = this.ultraDropDown1;
//Assign UltraCombo To Cell
e.Layout.Rows[1].Cells[0].EditorComponent = this.ultraCombo1;
//Button in Cell
e.Layout.Rows[2].Cells[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
}
You can find more information about the above-mentioned controls on the following links:
https://www.infragistics.com/help/winforms/wingrid
https://www.infragistics.com/help/winforms/windropdown
https://www.infragistics.com/help/winforms/wincombo
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7841
https://msdn.microsoft.com/en-us/library/aa984320(v=vs.71).aspx
Thanks Plamena Miteva. I tried with Column Header caption change and hiding the column and it works. Thank you very much.
I will try for implementing other requirement too. Thank you very much for your support.
Hi Selvakumar,
I am glad that you were able to implement some of the requirements.
Let me know if I could help with something else.
Sure Plamena. Now I am implementing events for drop down and check box. I will let you know if I am facing any issue.
Thank you, Selvakumar. If you have any other questions, I shall be happy to answer them.