Solved

ASP.net VB.net CheckBox template field is blank

Posted on 2016-09-21
4
26 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now