Reputation: 2681
In windows C# data grid view , I use cell click event and what i have to use for asp.net c# grid view ?
Upvotes: 1
Views: 1007
Reputation: 71573
Short answer, there isn't a handler for an individual cell in the ASP.NET GridView. However, you could still use JavaScript, or the Command architecture built into GridViews, to achieve a similar result. For instance, you could make the data in the cells HyperLinks, with a NavigateUrl property set to run a JS function that changes the cell color, disables/enables controls, etc. You could use CSS to make these links look like ordinary text if you wanted. You could also set up CommandButtons like "Select", "Edit", "View" etc, that can then be handled server-side and customized to do pretty much whatever you want.
Upvotes: 1
Reputation: 29725
For the ASP.Net GridView, you will want to create a hyperlink or linkbutton control in the item template and assign it to have the "CommandName" attribute with one of several options.
These will trigger the appropriate RowEditing, RowDeleting, etc. methods available.
You can also create your own command names and put them into the CommandName field, these custom commands will trigger the RowCommand event and you can process them accordingly. Use the CommandArgument parameter to provide additional details, such as a row Id.
Upvotes: 0