Solved

ASP.net VB.net CheckBox template field is blank

Posted on 2016-09-21
4
45 Views
Last Modified: 2016-09-21
Hi

I add a Checkbox template field to a GridView using the following code. The cells are blank and don't show any checkboxes.
What have I done wrong?

              Dim oCheckBoxField As New CheckBoxField
                        oCheckBoxField.HeaderText = "Check"
                        oGridView.Columns.Add(oCheckBoxField)

Open in new window

0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:CraigYellick
ID: 41809187
Did you set AutoGeneratedColumns=false?  Where is the code you posted located, which event?
0
 

Author Comment

by:murbro
ID: 41809200
The code is in the Page_Load event. I did not set AutoGeneratedColumns=false
0
 
LVL 11

Accepted Solution

by:
CraigYellick earned 500 total points
ID: 41809263
Is this checkbox intended to be used for allowing the user to select multiple items in the grid? If so this is quite complicated and there are several detailed walk-throughs available. Here's one that includes selected rows highlighting:

http://www.codeproject.com/Articles/14437/Extending-GridView-by-allowing-Multiple-Selections

Here's a very simple implementation, in two parts:

http://www.niteshluharuka.com/how-to-add-a-checkbox-column-to-gridview-in-aspnet
http://www.niteshluharuka.com/how-to-get-multiple-selected-rows-from-gridview-in-aspnet
0
 

Author Closing Comment

by:murbro
ID: 41809270
Thanks very much
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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

726 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