Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. <asp:ScriptManager ID="ScriptManager1" runat="server" />
  2. <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers ="false">
  3. <ContentTemplate>
  4. <asp:GridView ID="gvEventMechanic" runat="server" AutoGenerateColumns="False" PageSize="5"
  5. GridLines="None" AllowSorting="true" BorderWidth="1"
  6. EnableViewState="true" AllowPaging="true">
  7. <Columns>
  8. <asp:TemplateField>
  9. <HeaderTemplate>
  10. Disable
  11. </HeaderTemplate>
  12. <ItemStyle HorizontalAlign="Center" />
  13. <ItemTemplate>
  14. <asp:CheckBox ID="chkDelete" runat="server" AutoPostBack="true" ></asp:CheckBox>
  15. </ItemTemplate>
  16. </asp:TemplateField>
  17. </Columns>
  18. </asp:GridView>
  19. </ContentTemplate>
  20. <Triggers>
  21. <asp:AsyncPostBackTrigger ControlID="chkDelete" EventName="CheckBoxEventChanged" />
  22. </Triggers>
  23. </asp:UpdatePanel>
  24.  
  25. $('#input[type=checkbox][id*=chkDelete]').change(function(){
  26. $('#button').toggleClass('disabled');
  27. });
  28.  
  29. $('#input[type=checkbox][id*=chkDelete]').change(function(){
  30. if ($(this).is(':checked'))
  31. {
  32. $('#button').removeAttr('disabled');
  33. }
  34. else
  35. {
  36. $('#button').attr('disabled', 'disabled');
  37. }
  38. });
  39.  
  40. // If you bind a list of objects as your data source you can use this to get the
  41. // index into the list.
  42. protected void OnCheckedChanged( Object sender, EventArgs e )
  43. {
  44. if ( sender is CheckBox )
  45. {
  46. // we do this to get the index into the list of the item we want to work with.
  47. CheckBox cb = sender as CheckBox;
  48. GridViewRow gvr = cb.NamingContainer as GridViewRow;
  49.  
  50. int dataItemIndex = gvr.DataItemIndex; // index into your list, regardless of page
  51. int rowIndex = gvr.RowIndex; // row index in gridview.
  52. }
  53. }
Add Comment
Please, Sign In to add comment