Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Editor box text is always blank

$
0
0

I'm trying to retrieve a value from an editor box when the focus changes using ajax.  I want to pull that text and send it as POST data to my handler.

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)<div class="editor-label">
        @Html.LabelFor(model => model.PipeSize)</div><div class="editor-field" id="PipeSize">
         @Html.EditorFor(model => model.PipeSize)</div>
}<script>$("#PipeSize").focusout(function () {
        updateData("ExitHeaderPipeConnSize", ($("#PipeSize").val()))
    });

    function updateData(field, numvalue) {
        $.ajax({
            url: "/Eval/UpdateData",
            type: 'Post',
            data: { fieldName: field, fieldValue: numvalue },
            success: function (data) {
                //do nothing for now
            },
            error: function () {
                alert("something seems wrong");
            }
        });
    }</script>

The UpdateData(string fieldName, string fieldValue) Handler inside the Controller updates the data fieldName properly.  But the fieldValue (the text from the editor box) always comes back blank.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>