Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to get the comboBox for a specific Cell. How to do it. I tried but i cann't do this. I can't understand what is the problem in my code.



Hope you understand.


Regards,
Shahana

What I have tried:

C#
if (Convert.ToInt32(ddlModule.SelectedValue) == 5
    && _entryType == Constants.EntryType.ENTRY_TYPE_DAILY)
{
    column = new GridColumn();
    column.Name = "Actual";
    column.Caption = "Actual";
    column.Width = 125;
    column.AllowEdit = true;
    column.Type = GridColumnType.Int32;
    foreach (GridRow row in gridControl.Rows)
    {
        if(GridRow.Rows[i].Cells[2])
        {
            column.Type = GridColumnType.EditableCombo;
        }
    }

    gridControl.AddColumn(column);
}
Posted
Updated 10-Aug-16 22:05pm
v2
Comments
njammy 11-Aug-16 4:08am    
Hi Pinky,
please clarify something, your question is about how to retrieve a control from a grid control but your code sample is showing us how to add a control. This is confusing.

Can you please explain the technology you are using as well, 'web forms', 'win forms' etc.
Pinky Shahana 11-Aug-16 4:16am    
I am using Win forms and a grid control.
private void PrepareColumns()
{
List<ParamValue> searchItems = new List<ParamValue>();
_measure = new Measure();
_measure = _measure.GetData(searchItems);


gridControl.AllowAddNew = false;
gridControl.AllowDelete = false;

gridControl.ClearRows();
gridControl.ClearColumns();

GridColumn column = new GridColumn();
column.Name = "Description";
column.Caption = "KPI Description";
column.Width = 250;
column.AllowEdit = false;
column.Type = GridColumnType.String;
gridControl.AddColumn(column);
if (Convert.ToInt32(ddlModule.SelectedValue) == 5 && _entryType == Constants.EntryType.ENTRY_TYPE_DAILY)
{
//column = new GridColumn();
//column.Name = "Actual";
//column.Caption = "Actual";
//column.Width = 125;
//column.AllowEdit = true;
//column.Type = GridColumnType.EditableCombo;
//column.ComboList = ("1");
//gridControl.AddColumn(column);
foreach (GridRow row in gridControl.Rows)
{
if ( row.Rows[i].Cells[2].)

column = new GridColumn();
column.Name = "IsChecked";
column.Caption = "IsChecked";
column.Width = 60;
column.AllowEdit = true;
column.Type = GridColumnType.Boolean;
gridControl.AddColumn(column);
}
}

column = new GridColumn();
column.Name = "Actual";
column.Caption = "Actual";
column.Width = 125;
column.AllowEdit = true;
column.Type = GridColumnType.Int32;
gridControl.AddColumn(column);

column = new GridColumn();
column.Name = "Remarks";
column.Caption = "Remarks";
column.Width = 125;
column.AllowEdit = true;
column.Type = GridColumnType.String;
gridControl.AddColumn(column);


}
njammy 11-Aug-16 4:23am    
Please clarify your question referring to your code and where it is not working as you expect. Click on Improve question to update it.
Pinky Shahana 11-Aug-16 4:51am    
I want to set combobox when my cell number is 2. But it's not working.
njammy 11-Aug-16 5:00am    
What do you want to "set" the combobox to?
Also, this line gridControl.AllowAddNew = false; is not winForms standard. Please can you be very detailed in the techonology and controls/plugins you are developing with?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900