Get ID of sender

2 posts, 0 answers
  1. Mike
    Mike avatar
    6 posts
    Member since:
    Nov 2006

    Posted 13 Dec 2007 Link to this post

    I've got a project where I will have 10 or more color pickers on a single page.  Each color picker will change different but similar elements on the page.

    I'd like to be able to write a single javascript function that handles all the element changes, but I cannot figure out how to determine which color picker has called the function.  I really need to get the sender's ID so I can determine which elements to change.

    An example of what I'm trying to do with a function that is hard coded to a set of elements for a single color picker.  If I get the ID color picker, I can adjust the correct elements.

    <script type="text/javascript">
    function changeBoxColor(sender, eventArgs)
    var box = document.getElementById('<%=  divSearch.clientID %>');
    var header = document.getElementById('<%=  divSearchH.clientID %>'); = sender.get_selectedColor(); = sender.get_selectedColor();

    <div id="divSearch" runat="server" class="section" >
    <div id="divSearchH" runat="server" class="header">
    Search Box
    <div class="inner">
    <table class="inputMin">
    Outline Color
    Text Color
  2. Petio Petkov
    Petio Petkov avatar
    825 posts

    Posted 17 Dec 2007 Link to this post

    Hi Scott Neu,

    You can get the ID with sender.get_id() method in the handler. Take a look at the following example where this method is used:

    Best wishes,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
Back to Top