function save(id, notes) { alert('want to save row id ? ' + id + notes) } @webGrid.GetHtml(mode: WebGridPage" /> function save(id, notes) { alert('want to save row id ? ' + id + notes) } @webGrid.GetHtml(mode: WebGridPage" /> function save(id, notes) { alert('want to save row id ? ' + id + notes) } @webGrid.GetHtml(mode: WebGridPage"/>

Asp.net MVC : Pass a value from webgrid text box column to the controller

767 Views Asked by At

<script type="text/javascript">
    function save(id, notes)
    {
        alert('want to save row id ? ' + id + notes)
    }

</script>
 @webGrid.GetHtml(mode: WebGridPagerModes.All,
                     tableStyle: "table table-sm table-hover table-striped table-bordered table-row,
                     headerStyle: "", rowStyle: "",
                     (columns: webGrid.Columns(webGrid.Column("Notes", format: @<text>
        <input type="text" name="txtNotes" id="txtNotes" style="width:100%;" />
         <input type="hidden" name="RecID" value="@item.RecID" />
        <a href="#" onclick="save('@item.RecID', '#txtNotes.val()');return false;">Save</a>
        </text>, canSort: false))

Hi All, In the above code I am trying to read the value from the txtNotes, after user enters something into an empty textbox or tries to edit an already existing notes. I am not able to get the value of txtNotes in either of the cases. Can someone please point me where am I going wrong?

Thank you very much!!

0

There are 0 best solutions below