[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to enable Selection for a GridView that assigns the DataSource in the code behind class?

Posted on 2012-03-11
3
Medium Priority
?
411 Views
Last Modified: 2012-03-12
Hi, I noticed that when I create a GridView that I am given the option to "Enable Selection" as long as I choose a DataSource in the GUI. However, I am binding the DataSource in the code behind class.

I added SelectMethod="GetCustomers" to my GridView control and an empty GetCustomers() method to my code behind class but I don't see a "Select" link appear in my GridView.

How can I enable "Selection" for my GridView if the DataSource is being bound in the code behind?

Not sure if this is relevant but my data is coming from my NorthwindDAL.GetCustomers() method which is returning a List of type <Customers>.
0
Comment
Question by:Eindoofus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Expert Comment

by:Alfredo Luis Torres Serrano
ID: 37709365
GridView1.AutoGenerateColumns = true;
 GridView1.AutoGenerateSelectButton = true;
0
 

Author Comment

by:Eindoofus
ID: 37710592
Thanks, do I put that into the Page_Load method?
0
 
LVL 12

Accepted Solution

by:
Alfredo Luis Torres Serrano earned 2000 total points
ID: 37710958
Yes it could be, At page load method

If !page.ispostback then
GridView1.AutoGenerateColumns = true;
 GridView1.AutoGenerateSelectButton = true;
endif
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question