Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <asp:ScriptManager ID="ScriptManager1" runat="server" />
- <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers ="false">
- <ContentTemplate>
- <asp:GridView ID="gvEventMechanic" runat="server" AutoGenerateColumns="False" PageSize="5"
- GridLines="None" AllowSorting="true" BorderWidth="1"
- EnableViewState="true" AllowPaging="true">
- <Columns>
- <asp:TemplateField>
- <HeaderTemplate>
- Disable
- </HeaderTemplate>
- <ItemStyle HorizontalAlign="Center" />
- <ItemTemplate>
- <asp:CheckBox ID="chkDelete" runat="server" AutoPostBack="true" ></asp:CheckBox>
- </ItemTemplate>
- </asp:TemplateField>
- </Columns>
- </asp:GridView>
- </ContentTemplate>
- <Triggers>
- <asp:AsyncPostBackTrigger ControlID="chkDelete" EventName="CheckBoxEventChanged" />
- </Triggers>
- </asp:UpdatePanel>
- $('#input[type=checkbox][id*=chkDelete]').change(function(){
- $('#button').toggleClass('disabled');
- });
- $('#input[type=checkbox][id*=chkDelete]').change(function(){
- if ($(this).is(':checked'))
- {
- $('#button').removeAttr('disabled');
- }
- else
- {
- $('#button').attr('disabled', 'disabled');
- }
- });
- // If you bind a list of objects as your data source you can use this to get the
- // index into the list.
- protected void OnCheckedChanged( Object sender, EventArgs e )
- {
- if ( sender is CheckBox )
- {
- // we do this to get the index into the list of the item we want to work with.
- CheckBox cb = sender as CheckBox;
- GridViewRow gvr = cb.NamingContainer as GridViewRow;
- int dataItemIndex = gvr.DataItemIndex; // index into your list, regardless of page
- int rowIndex = gvr.RowIndex; // row index in gridview.
- }
- }
Add Comment
Please, Sign In to add comment