Responding to checkbox in datagrid

P

Paul

I have a datagrid in which I am displaying a column as a checkbox. A
snippet of the aspx code where I use a template column to do this is shown
below.

I am at a loss as to how to respond to the checkbox being clicked. Any help
would be appreciated.

TIA

Paul

<asp:datagrid id="gridLocBased" style="Z-INDEX: 101; LEFT: 46px;
POSITION: absolute; TOP: 71px" runat="server" BorderWidth="3px"
BorderColor="DarkGray" BorderStyle="Double" AutoGenerateColumns="False"
HorizontalAlign="Center" Width="469px">
<AlternatingItemStyle Font-Size="X-Small"
BackColor="Cornsilk"></AlternatingItemStyle>
<ItemStyle Font-Size="X-Small" BorderWidth="3px" BorderStyle="Double"
BackColor="WhiteSmoke"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Bold="True"
HorizontalAlign="Center" ForeColor="Cornsilk"
BackColor="RoyalBlue"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Enabled">
<HeaderStyle Width="60px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:CheckBox runat="server" ID="cbxEnabled" Checked='<%#
Convert.ToBoolean( DataBinder.Eval( Container, "DataItem.Enabled" ) ) %>'
AutoPostBack="true">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
 
R

Rick Spiewak

You can add a handler to the checkbox during the pageload event. If you are
in edit mode, you can find the row from the edititemindex, then find the
checkbox by its ID and add the handler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top