By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Check box enabled in GridView?

P: n/a
How do you enable a check box in the GridView. I selected Checkbox Field in
the Columns of the GridView, and the check box shows up in the Grid view, but
it is disabled. How do I enable it so I can check/uncheck it. Also, what
event do I use to check it for a value? Any articles out there?
--
Chris Davoli

Aug 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Chris,

Could you show the code that's giving you trouble? Did you happen to set
something as read-only?

Ken
Microsoft MVP [ASP.NET]

"Chris Davoli" <Ch*********@discussions.microsoft.comwrote in message
news:DF**********************************@microsof t.com...
How do you enable a check box in the GridView. I selected Checkbox Field
in
the Columns of the GridView, and the check box shows up in the Grid view,
but
it is disabled. How do I enable it so I can check/uncheck it. Also, what
event do I use to check it for a value? Any articles out there?
--
Chris Davoli

Aug 2 '06 #2

P: n/a
Here is the code. I tried it two ways. One with a check box field and one
with a template and I dragged a check box over to the GridView. For the Check
box field it is set to read only. The template field lets me check/uncheck,
but There is nowhere to specify the data field. Where do I specify the Data
field with a template field?

Also, I know how to use the old DataGrid, but since the Gridview replaces
DataGrid, and the events are different, what are similar events for
Item_Command and Item_DataBound from the DataGrid, for the GridView? I found
RowCommand and RowDataBound. Are these the same? Do you have some snippets of
code to use to check a cell ie; e.Cells(0).Text like in the data grid to see
what the result of someone checking checkboxes in the GridView? I need code
snippets for DataBound before displaying and also after they check a box. Can
you refer me to some good articles?
<asp:GridView ID="dgApproval" runat="server"
AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True">
<Columns>
<asp:BoundField DataField="Suffix" HeaderText="Suffix" />
<asp:BoundField DataField="FirstName" HeaderText="First
Name" />
<asp:BoundField DataField="LastName" HeaderText="Last
Name" />
<asp:TemplateField HeaderText="Is Approved By Physician
Relations">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"
AutoPostBack="True" Text="Approved" />
</ItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField
DataField="IsApprovedByPhysicianRelations" ReadOnly="false" HeaderText="Is
Approved By Physician Relations2" />
<asp:BoundField DataField="MI" HeaderText="MI" />
<asp:BoundField DataField="Practice"
HeaderText="Practice" />
<asp:BoundField DataField="EmailAddress"
HeaderText="Email Address" />
<asp:BoundField DataField="Degree" HeaderText="Degree" />
<asp:BoundField DataField="Phone" HeaderText="Phone" />
<asp:BoundField DataField="Fax" HeaderText="Fax" />
<asp:BoundField DataField="Speciality"
HeaderText="Speciality" />
</Columns>
</asp:GridView>

--
Chris Davoli

"Ken Cox [Microsoft MVP]" wrote:
Hi Chris,

Could you show the code that's giving you trouble? Did you happen to set
something as read-only?

Ken
Microsoft MVP [ASP.NET]

"Chris Davoli" <Ch*********@discussions.microsoft.comwrote in message
news:DF**********************************@microsof t.com...
How do you enable a check box in the GridView. I selected Checkbox Field
in
the Columns of the GridView, and the check box shows up in the Grid view,
but
it is disabled. How do I enable it so I can check/uncheck it. Also, what
event do I use to check it for a value? Any articles out there?
--
Chris Davoli


Aug 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.