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 said:
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]