---
title: "How to enable Selection for a GridView that assigns the DataSource in the code behind class?"  
description: "How to enable Selection for a GridView that assigns the DataSource in the code behind class?"  
author: "Manoj Bhatt"  
published: 2014-09-02  
updated: 2014-09-02  
canonical: https://www.mindstick.com/forum/2230/how-to-enable-selection-for-a-gridview-that-assigns-the-datasource-in-the-code-behind-class  
category: "asp.net"  
tags: ["how to enable selection for a gridview", "gridview enable selection in c#", "mindstick"]  
reading_time: 1 minute  

---

# How to enable Selection for a GridView that assigns the DataSource in the code behind class?

when I create a [GridView](https://www.mindstick.com/articles/873/update-delete-edit-gridview-in-asp-dot-net) and I [choose](https://www.mindstick.com/articles/13030/how-to-choose-the-best-online-bitcoin-casino) a [DataSource](https://www.mindstick.com/blog/447/listing-the-databases-connected-to-the-datasource) in the GUI. However, I am [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) the DataSource in the [code behind](https://www.mindstick.com/forum/2199/call-javascript-s-function-from-code-behind) [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp).

I added SelectMethod="GetCustomers" to my GridView [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) and an empty GetCustomers() [method](https://www.mindstick.com/forum/166/webservice-method) to my code behind class but I don't see a "[Select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance)" link appear in my GridView.

How can I enable "[Selection](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box)" for my GridView if the DataSource is being bound in the code behind?

\


---

Original Source: https://www.mindstick.com/forum/2230/how-to-enable-selection-for-a-gridview-that-assigns-the-datasource-in-the-code-behind-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
