This is a migrated thread and some comments may be shown as answers.

How to reference controls on pop-up editor

2 Answers 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AP
Top achievements
Rank 1
Veteran
AP asked on 22 Nov 2013, 08:57 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 26 Nov 2013, 08:27 AM
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!
0
AP
Top achievements
Rank 1
Veteran
answered on 26 Nov 2013, 08:47 AM
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.
Tags
Grid
Asked by
AP
Top achievements
Rank 1
Veteran
Answers by
Daniel
Telerik team
AP
Top achievements
Rank 1
Veteran
Share this question
or