Command Name = "Cancel") Then ' Retrieve the row index stored in the Command Argument property. Text ' Retrieve the row that contains the button from the Rows collection. Text If Status = "Out on Loan\Reserved for Loan" Then Using my Literature Catalogue As New Model1. This will ensure that: 1) a consistent set of business rules are used everywhere within the application, 2) we write less code and don't repeat ourselves, and 3) we can easily modify/adapt our business rules at a later date and not have to update them in dozens of different places across our application.We will also take advantage of the built-in paging/sorting support within LINQ to SQL to ensure that features like the product listing paging/sorting are performed not in the middle-tier, but rather in the database (meaning only 10 products are retrieved from the database at any given time - we control is an ASP.
In my code I tend to write the databinding logic as part of the page logic which usually is just a couple of lines of code.Anyway, the problem isn't that it can't be done 'manually' - but rather that there are a myriad of ways that you can hook up custom link/command processing and they are all similar but yet quite different.None of them feels natural to me, so quite frequently - especially if I haven't written that code in a while - I spent way more time than I should rediscovering what approach I should use the hard way.So I'm taking a few minutes - for my own sake - to write this stuff down so I can look it up next time I have a brain fart Using a Button Field you can specify a Command Name which in turn provides the On Row Command event some context as to what type of operation you are dealing with in Code Behind.In Code Behind you have to do a bit of work though if you want to retrieve the proper context from a Data Item.