Solved

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

Posted on 2012-03-11
3
397 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
  • 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to double quote a string for an inline sql statement. 8 73
Vb.net threads keep increasing 2 36
ASP.NET Content Page 3 29
Amazon S3 .Net error 5 18
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

837 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