Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is where jQuery really shines for ASP.Net developers. Lets say you have this ASP button:</p> <p></p> <p>When that renders, you can look at the source of the page and the id on it won't be btnAwesome, but $ctr001_btnAwesome or something like that. This makes it a pain in the butt to find in javascript. Enter jQuery.</p> <pre> $(document).ready(function() { $("input[id$='btnAwesome']").click(function() { // Do client side button click stuff here. }); }); </pre> <p>The id$= is doing a regex match for an id ENDING with btnAwesome.</p> <p>Edit:</p> <p>Did you want the ajax call being called from the button click event on the client side? What did you want to call? There are a lot of really good articles on using jQuery to make ajax calls to ASP.Net code behind methods.</p> <p>The gist of it is you create a <strong>static</strong> method marked with the WebMethod attribute. You then can make a call to it using jQuery by using $.ajax.</p> <pre> $.ajax({ type: "POST", url: "PageName.aspx/MethodName", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { // Do something interesting here. } }); </pre> <p>I learned my WebMethod stuff from: <a href="http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/" rel="noreferrer">http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/</a></p> <p>A lot of really good ASP.Net/jQuery stuff there. Make sure you read up about why you have to use msg.d in the return on .Net 3.5 (maybe since 3.0) stuff.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload