How to reference controls on pop-up editor

3 posts, 1 answers
  1. AP
    AP avatar
    219 posts
    Member since:
    Apr 2010

    Posted 22 Nov 2013 Link to this post

    I want to implement a custom routine that is triggered by a button on a pop-up editor, from a grid.

    The routine needs to be passed values that the user has entered into the form (but before the form has been submitted) .  How can I obtain these values from a function called from a buttons onclick handler?

    I know that its possible to reference controls from the grids edit event, using the e.container object, but how do I do this outside of the edit event?

    e.g:-  I have a text box defined:-
    <p>  <span class="fieldlabel2">
               Target Table:
            </span>
     
                @Html.TextBoxFor(c => c.TargetTable, new { style = "width:200px", Maxlength = 50 })
                @Html.ValidationMessageFor(c => c.TargetTable)
              
    </p>
    How can I get the value typed into this from a function (not the edit event handler)?
  2. Answer
    Daniel
    Admin
    Daniel avatar
    2214 posts

    Posted 26 Nov 2013 Link to this post

    Hello,

    You can find the element in the edit event or in the click handler by ID e.g.
    function onButtonClick(){
        var value = $("#TargetTable").val();
    }


    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. AP
    AP avatar
    219 posts
    Member since:
    Apr 2010

    Posted 26 Nov 2013 Link to this post

    Thanks for this.

    I was sure I tried this, but I think I left off the brackets at the end of the val statement - as I got back a lot of JavaScript.

    This works now.
Back to Top