Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a asp.net mvc project, I use three button. When i click a button like "KOT" button, i want a pop up window. In pop up window want to save some data like Restaurant food order information. After click save button, pop up window don't hide and that saved data will show in the right side of that pop up window.



/* Index View */
@Html.ActionLink("KOT ", "ViewLyubomir", "Home", new { id = item.TableNo }, new { @class = "modal-link btn btn-primary btn-large" })


/* LayOut View */


<script type="text/javascript">
$(function () {
// Initialize numeric spinner input boxes
//$(".numeric-spinner").spinedit();

// Initalize modal dialog
// attach modal-container bootstrap attributes to links with .modal-link class.
// when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.
$('body').on('click', '.modal-link', function (e) {
e.preventDefault(true);

$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});

$('body').on('click', '.modal-Imam', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});

// Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});

//clear modal cache, so that new content can be loaded
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});

$('#CancelModal').on('click', function () {
return false;
});
});
</script>

/* "KOT" partial view */
On the bottom of KOT i am using this script

<script type="text/javascript">
$(function () {
$('#approve-btn').click(function (e) {
$('#modal-container').modal('show');
e.preventDefault(true);
});
});
</script>

What I have tried:

when i click 'KOT' button pop up window come. but after click save button on pop up window, that going to be hide, I can not prevent this
Posted
Updated 25-Feb-16 2:14am
v2
Comments
[no name] 25-Feb-16 1:00am    
Firstly onclick of save button you need to fetch data from DB and display it instead of closing. Just find where it is closing and put code for data display.

Secondly what is the code for POPUP window. Improve your question and provide relevant code.
Member 12350213 25-Feb-16 8:12am    
/* Index View */
<td align="right">
@Html.ActionLink("KOT ", "ViewLyubomir", "Home", new { id = item.TableNo }, new { @class = "modal-link btn btn-primary btn-large" })
</td>

/* LayOut View */
<div id="modal-container" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-content">
</div>
</div>

<script type="text/javascript">
$(function () {
// Initialize numeric spinner input boxes
//$(".numeric-spinner").spinedit();

// Initalize modal dialog
// attach modal-container bootstrap attributes to links with .modal-link class.
// when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.
$('body').on('click', '.modal-link', function (e) {
e.preventDefault(true);

$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});

$('body').on('click', '.modal-Imam', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});

// Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});

//clear modal cache, so that new content can be loaded
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});

$('#CancelModal').on('click', function () {
return false;
});
});
</script>

/* "KOT" partial view */
On the bottom of KOT i am using this script

<script type="text/javascript">
$(function () {
$('#approve-btn').click(function (e) {
$('#modal-container').modal('show');
e.preventDefault(true);
});
});
</script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900