Link to home
Start Free TrialLog in
Avatar of dcl120748
dcl120748Flag for United Kingdom of Great Britain and Northern Ireland

asked on

How to create an event for a GridView CheckBox TemplateField

I have a number of TemplateFields created as CheckBoxes in a Gridview and need to create an event so that when any one of them is clicked it fires an event.
<asp:TemplateField HeaderText="SD" SortExpression="site_down">
                    <EditItemTemplate>
                        <asp:CheckBox ID="chkSD" runat="server" 
                            Checked='<%# Bind("site_down") %>' />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSD" runat="server" Checked='<%# Bind("site_down") %>' 
                            Enabled="<%# true %>" />
                    </ItemTemplate>
                    
                </asp:TemplateField>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Kaushal Arora
Kaushal Arora
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcl120748

ASKER

Thanks for that. I have given them command names and do use them for other purposes. Simply my problem is (and I am running short of time)  that when I click on one of these boxes I need it to fire an event that I can trap. For example when I click on the CheckBox where the ID is "chkSD" (as above) I want to trigger an event. I suspect there is also the issue of 'PostBack' here as well?
I have no objection but I am just surprised that for a second time in a row I have asked a question, then responded to a request for further information and then heard absolutely nothing. I am questioning the value of being a premium member.