Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel 2 posts 22 karma points
    May 04, 2011 @ 18:00
    Daniel
    0

    jquery in usercontrol

    i'm quite new to umbraco

    I'm trying to use jquery with umbraco but i cant get it to work.

    i hope some one can help me out.

    I'm including jquery like this in my mastertemplate I supose that's it correct.

    and now I vould like to use jquery inside a usercontrol the usercontrol is working correct in umbraco but I don't know how to access concroels from the user control

    I have tryed this

    $(document).ready(function () {
    $('#<%=lnkbtnResultatSkemaPrint.ClientID%>').click(function () {
    alert('the link is clicked');
    }
    );
    });

    but cant get it to work

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 04, 2011 @ 18:38
    Jan Skovgaard
    0

    Hi Daniel

    First of I have moved this topic into the "API questions" category since it's not related to XSLT where you posted it :-)

    What happens if you reference the jquery in your user control instead?

    Could you perhaps provide us with a snippet of your user control?

    And if you're using firebug don't you then get any errors in the console?

    /Jan

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 05, 2011 @ 13:57
    Bo Damgaard Mortensen
    0

    Daniel,

    While $('#<%=lnkbtnResultatSkemaPrint.ClientID%>') would be best practice you are also able to find the asp.net controls with jQuery like this:

    jQuery("[id$='_X']");
    jQuery("[id$='_Y']");

    It simply searches for any element with an ID with '_X' and '_Y' in it.

    I.e. my controls would look like this:

    <asp:HiddenField ID="X" runat="server" />
    <asp:HiddenField ID="Y" runat="server" />

    But as Jan wrote: try to have a look at the error console in FireBug, it will be your favorit debuggingtool when it comes to the clientside :-)

    All the best,

    Bo

Please Sign in or register to post replies

Write your reply to:

Draft