checkbox in datagrid

r3sann

New member
Joined
Jan 3, 2005
Messages
1
Programming Experience
Beginner
hello,

can anyone help me...

how to add column which contains checkbox in each row...

i am using a dataset...

can u give me an example?



pls..
 
Add a tablestyle, and column styles. To add the Checkbox add a DataGridBoolColumn. (It's in the add pull down)

TPM
 
hi,

If you are using vb.net then its very simple, declare a column with its id or name and then do the following. You can put this code in the body tag of your page where you define your datagrid and i have implemented checkboxes in every row by this code, different people may use different other techniques. However this works!!

If you have any problems let me know. I hope this helps,
Vikram
----------------------------------------------------------------------------------
<asp:datagrid ID="MyDataGrid" runat="server"
AutoGenerateColumns="False" EnableViewState="True"
AlternatingItemStyle-BackColor="#ffffcc"
FooterStyle-BackColor="#6699ff"
HeaderStyle-BackColor="#6699ff"
Font-Size="8pt" Font-Name="Arial" CellSpacing="0" CellPadding="3"
ShowFooter="false" BorderColor="black" BackColor="#ffffff" Width="97%"
PagerStyle-Mode="NumericPages"
PageSize="300" AllowPaging="False" AllowSorting="true" OnSortCommand="MyDataGrid_Sort"
>
<columns>
<asp:templatecolumn HeaderText="Notify" ItemStyle-HorizontalAlign="Center">
<itemtemplate>
<asp:Checkbox Id="cb" runat="server" />
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
-----------------------------------------------------------------------------------
 
Back
Top