Free Support Forum - aspose.com

Gridweb Validation on a Column

Hi,

I need to create a Validation DropdownList on an entire column of a worksheet which is bound to a Dataset. I managed to create it at cell level but i want to avoid looping all rows and create the validation on the column for each and every row. Is there a way to create the validation on the entire column?

thanks

Hi,

Well, if you are using GridWeb’s Data Binding feature then you may add any validation type for the whole column, see the demo for your reference: http://www.aspose.com/demos/.net-components/aspose.cells/csharp/grid/data-bind/databind2.aspx. But other than that, I am afraid, you need to loop through each cell in the whole column cells and apply validation for your desired type.

E.g.,

WebWorksheets sheets = GridWeb1.WebWorksheets;
WebCells cells = sheets[0].Cells;
WebCell cell
//Apply validation to C column
for (int i = 0;i<100;i++)
{
cell = cells[i,2]
cell.CreateValidation(ValidationType.DropDownList, true);
//…

}

Thank you.