textboxes are empty on postback with bootstrap modal asp.net

前端 未结 4 2153
野趣味
野趣味 2021-02-15 23:59

I am using bootstrap modal in my asp.net page like this:

   
4条回答
  •  借酒劲吻你
    2021-02-16 00:39

    The reason why the you are not seeing your posted values, is because your values are not being posted. The bootstrap modal manager uses the 'body' element as the root element to which it appends your modals. As a result your modals are now outside the 'form' element and the values are not being posted back to the server.

    To fix this, change the default value of the 'manager' property as follows:

    // Note the manager is passed to the root form element. 
    // Otherwise, the modals are taken out of the form and 
    // values not posted back to the server
    $.fn.modal.defaults.manager = $.fn.modalmanager.defaults.manager = 'body form:first';
    

    EDIT: This is assuming you are using the Bootstrap-Modal Extension

提交回复
热议问题