This is a migrated thread and some comments may be shown as answers.

Hooking up CheckBox in GridTemplateColumn to AsyncPostBackTrigger

1 Answer 102 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Andrew asked on 04 May 2012, 01:47 AM
I've been scouring the threads for an example like mine and I've found bits and pieces, but haven't been able to put everything together to get what I want to work.  What I have is a grid with a checkbox in the first column that I want to perform an action on check changed.  I also have a button in the last column that puts the grid into edit mode.  Around everything I have an UpdatePanel. 

My problem is setting my triggers for only the checkbox on checkchanged.  I can set children as triggers, but that will cause the other button to trigger which I don't want.  I tried trying to programaitcally add the trigger in the ItemCreated event, but to no avail.

Relevant code as followed.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">     
                   <rad:RadGrid ID="rg" OnUpdateCommand="Update" OnNeedDataSource="BindItems"  OnItemDataBound="rg_ItemDataBound" OnPreRender="rg_PreRender" runat="server"  >            
                    <PagerStyle Position="Top" />                
                    <MasterTableView DataKeyNames="ID" CommandItemDisplay="None">               
                            <asp:ImageButton ID="ImageButton1" ImageUrl="/admin/images/add-record.jpg" CommandName="InitInsert" runat="server" /> Add New
                            <rad:GridTemplateColumn HeaderStyle-Width="40px" HeaderText="Email">
                                    <asp:CheckBox id="cbEmail" AutoPostBack="true" OnCheckedChanged="AddToEmailList" runat="server" />                                                      
                                          // a handful of other columns
                             <rad:GridEditCommandColumn EditText="More" HeaderStyle-Width="30" />

Again, I want to only asynchronously postback when that checkbox is checked. Thanks for any help in advance.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 09 May 2012, 01:05 PM
Hello Andrew,

You can use the following online demo for Partial ajaxification as bases for implementing your scenario.

All the best,
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question