Question

Have a gridview control which will show X amount of rows. I want to the user to be able to select y number of rows, but limit the maximum selected rows to a set view, such as 3. If the user tries to select a fourth row I don't want them to be able to until they unselect a row.

Anyway to do this?

Thanks

Was it helpful?

Solution

Since the GridView works with single selections, how are you allowing them to select the values in the first place, on the client or server? If on the client, you can use JavaScript to do this; simply store an array of the table rows that are selected, if the length is three, then block adding to the array until the user deselects...

Please update how you are doing it, and I can post further.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top