code_junkie

Getting ID of embedded ASP Object using JavaScript and jQuery

Nov 12th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. $(document).ready(function() //when DOM is ready, run containing code
  2. {
  3. <% if (grvTimeSheets.EditIndex > -1) {%>
  4. $(#<%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %>).change(function() {
  5. $(#<%= grvTimeSheets.ClientID %>).block({ message: null }
  6. });
  7. }
  8. );
  9. <% } %>
  10.  
  11. <script type="text/javascript" src="jquery.js"></script>
  12. <script type="text/javascript" src="jquery.tablesorter.js"></script>
  13. <script type="text/javascript" src="jquery.blockUI.js"></script>
  14. <script type="text/javascript">
  15. $(document).ready(function() //when DOM is ready, run containing code
  16. {
  17.  
  18. }
  19. );
  20. </script>
  21.  
  22. <script type="text/javascript" src="jquery.js"></script>
  23. <script type="text/javascript" src="jquery.tablesorter.js"></script>
  24. <script type="text/javascript" src="jquery.blockUI.js"></script>
  25. <script type="text/javascript">
  26. $(document).ready(function() //when DOM is ready, run containing code
  27. {<% if (grvTimeSheets.EditIndex > -1) {%>
  28. var id = '#<%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %>';
  29. $(id).change(function() {
  30. $(id).block({ message: null }
  31. });
  32. <% } %>
  33. }
  34. );
  35. </script>
  36.  
  37. DropDownList ddl (DropDownList)grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients");
  38. if (ddl != null)
  39. {
  40. ClientScriptManager csm = Page.ClientScript;
  41. Type cstype = this.GetType();
  42. String csname1 = "PopupScript";
  43.  
  44. string script = @"
  45. <script language='javascript' type='text/javascript'>
  46. $(#" + ddl.ClientID + ").change(function() { $(" + grvTimeSheets.ClientID + ").blockUI({ message: null }});} </script>";
  47. csm.RegisterStartupScript(cstype, csname1, script, true);
  48.  
  49. }
  50.  
  51. $(document).ready(function() //when DOM is ready, run containing code
  52. {
  53. <% if (grvTimeSheets.EditIndex > -1) {%>
  54. var id = '#<%=grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients").ClientID %>';
  55. $(id).change(function() {
  56. $(id).block({ message: null }
  57. });
  58. <% } %>
  59. }
  60. );
  61.  
  62. string script = @"<script type=text/javascript> var myControlId = '" + ddl.ClientId "';") + "</script>"
  63.  
  64. $(function() {
  65. $("select.yourMarkerClass").change(....);
  66. });
  67.  
  68. $('[id$=ddlClients]')
  69.  
  70. DropDownList ddl = (DropDownList)grvTimeSheets.Rows[grvTimeSheets.EditIndex].FindControl("ddlClients");
  71. if (ddl != null)
  72. {
  73. ClientScriptManager csm = Page.ClientScript;
  74. Type cstype = this.GetType();
  75. String csname1 = "PopupScript";
  76.  
  77.  
  78. string script = @"
  79. <script language='javascript' type='text/javascript'>
  80. jQuery(#" + ddl.ClientID + ").change(function() { $(" + grvTimeSheets.ClientID + ").blockUI({ message: null }});} </script>";
  81. csm.RegisterStartupScript(cstype, csname1, script, false);
Add Comment
Please, Sign In to add comment