1
votes

I'm developing an application in asp.net, how can I perform the following on GridView control?

GridView control ave a "sequence" column with DropDownList (choice of 1,2,3,4...) to allow rows sorting, user can select numbers from DropDownList as the row sequence.

The sequence should not repeating, mean selected number should not appear twice.

Can it be done? please advise.

Thank you in advanced.

1
Not sure what you are asking here. Can you please reword/clarify? - Shai Cohen

1 Answers

0
votes

If I understand, you want to be able to sort your rows using a DropDownList that is a cell in each row. You want this SortOrder value on each row to have a unique value (so no row has the same SortOrder). You can accomplish this with a little programming... you could implement something to validate that each choice is a unique one. Or, when you select say "3" on a row, then remove "3" as a selection from the DropDownList of the other boxes.

For sorting, a DataView helps, which you can turn back into a table.

DataView dv = yourGridView.DefaultView;
dv.Sort = "SortOrder desc";
DataTable newSortedDt = dv.ToTable();