Advertisement
PepperoniPapaya

fixes

Feb 5th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. 1) Add reference System.Web.Extensions to get rid of Update panel annoying errors.
  2. 2) Use
  3. function pageLoad() {
  4. //code goes here
  5. }
  6. for JS with UpdatePanel
  7.  
  8. 3)
  9. <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
  10. <script type="text/javascript">
  11. function pageLoad() {
  12. // Code to copy the gridview header with style
  13. var gridHeader = $('#<%= GridView1.ClientID%>').clone(true).attr('id', 'clonedGrid');
  14. //Code to remove all rows except the header row
  15. $(gridHeader).find("tr:gt(0)").remove();
  16. $('#<%= GridView1.ClientID%> tr th').each(function (i) {
  17. //Dealing with annoyinng JQuery's Chrome bug
  18. var headerWidth = $(this).width();
  19. var isChrome = !!window.chrome && !!window.chrome.webstore;
  20. if (isChrome) {
  21. headerWidth += parseInt($(this).css('border-left-width'), 10);
  22. }
  23. // Here Set Width of each th from gridview to new table th
  24. $("th:nth-child(" + (i + 1) + ")", gridHeader).css('width', headerWidth.toString() + "px");
  25. // Here Set height of each th from gridview to new table th
  26. $("th:nth-child(" + (i + 1) + ")", gridHeader).css('height', ($(this).height()).toString() + "px");
  27. });
  28. // Append Header to the div controlHead
  29. $("#headerDiv").append(gridHeader);
  30. // Set its position to be fixed
  31. $('#headerDiv').css('position', 'absolute');
  32. // Bring the header in front of everything else
  33. $('#headerDiv').css('z-index', '200');
  34. // Put it on top
  35. //$('#headerDiv').css('top', '-10');
  36. }
  37. </script>
  38.  
  39. 4) No need for Gridview border in ascx
  40. also GridLines="None"
  41.  
  42. .rowStyle td {
  43. border: 1px solid #CDCDCD;
  44. }
  45.  
  46. .fixedHeader th {
  47. border: 1px solid #CDCDCD;
  48. }
  49.  
  50. 5) Consider setting mindwidth for TableDiv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement