How do i send the data to edit boxes on the same page?

前端 未结 2 348
花落未央
花落未央 2021-01-17 05:39

i have the following page generated

when i click the Edit link, the record data must be sent to the input boxes on teh same page (without refreshing the pa

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-17 06:06

    Give you 'Edit' link a class name (say) class="edit" and handle its .click() event to update the form controls

    $('.edit').click(function() {
      var cells = $(this).closest('tr').children('td');
      $('#Code').val(cells.eq(0).text());
      $('#ProdName').val(cells.eq(1).text());
      return false; // cancel the default redirect
    });
    

    Side note: You could just replace the ActionLink() code with Edit and the return false; line is not necessary.

提交回复
热议问题