hello
I have to display combo box in grid. when we add new record they can select values from combobox. can we place combobox in grid?.
hello
I have to display combo box in grid. when we add new record they can select values from combobox. can we place combobox in grid?.
Hi,
Thanks for considering Aspose.
Well, yes, you may apply dropdownlist validation on your required column. At design time, click the BindColumns in Worksheet Collection Editor of the GridWeb, select the required column and click the validation property and specify the validation type. You may also set the validation at runtime i.e.,
...........
sheet.BindColumns["CategoryID"].Validation = myvalidation;
For further ref, please check the source of first two DataBinding Demos in the our featured demos.
Thank you.
Hai,
Thanks for your reply.
Actually that's not the problem. I want to insert a combo box in Datagrid. I have some default values, i want to choose that values in run time, for that i have to use combobox. Is't possible to put a combo box in grid ??????. Give me some example code for that.
Thank you
Hi,
Well, the dropdown list will be implemented as dropdown list validation. Please consult the following code:
if i get it right, he never asked about validation.
he just wants to know how to add a combobox at runtime to the aspose grid.
something like this (just an example, i don’t know how to do it)
WebWorksheet sheet = GridWeb1.WebWorksheets[0];
WebCell cell = sheet.Cells[“C1”];
cell.controls[0] = new DropDownList();
Hi,
If I'm not at wrong, you mean that the data should not be validated for your need. No worry, the sample code which I sent you the data will not be validated, the code just implements a dropdownlist on cell C1 and no validation at all when you submit the data. Validation occurs only if you apply i.e., GridWeb1.ForceValidation = true;
Thank you.
hi,
thanks for your reply.
i have written this code
protected void GridWeb1_RowInserted(object sender, RowColumnEventArgs e)
{
WebWorksheet sheet1 = this.GridWeb1.WebWorksheets[0];
//int xx = GridWeb1.ActiveCell.Row;
int xx = sheet1.Cells.MaxRow + 1;
WebCell cell = sheet1.Cells["BI" + xx + ""];
Validation v = cell.CreateValidation(ValidationType.DropDownList, true);
v.ValueList.Add("Pre-Lay");
v.ValueList.Add("Post-Lay");
}
its working fine. when we add new row its fine. but i need this functionality wherever i click on the grid. activecell.row;
we have four rows in grid. i want to modify thosee columns. if i click on 2nd row it has to display the combobox in 2nd row.
not only when we add new row, we need to display the combobox in active row.
how can i do that
Hi,
I think you are doing fine... when you insert new row, the dropdown list will be added the your required cell. The drop down will not be shown unless you click on the cell (which you have attached dropdown list).
Thank you.