Limiting gridview row selection in ASP.Net web page
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 v开发者_开发知识库iew, 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
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.
精彩评论