如何显示在MVC DOTNET的提交按钮的textarea弹出窗口 [英] How to show textarea popup window on submit button in MVC DotNet
问题描述
我工作的MVC点网,我有一个按钮,当我在此按钮上点击我要显示与文本区域和文本区域的文字中的一个弹出框会插上分贝。
这一切与MVC剃刀工作。
i am working on mvc dot net, and i have one button and when i clicked on this button i want to display one popup box with textarea and text of text area will insert on db. this all working with MVC razor.
喜欢上了这URL this..my code
like this..my code on this URL
<一个href=\"http://stackoverflow.com/questions/22989631/how-to-call-client-side-click-on-html-submit-button-in-mvc/22990214?noredirect=1#comment35154558_22990214\">How上调用HTML客户端点击MVC中提交按钮
推荐答案
请参阅此code为jQuery用户界面对话框中的 https://jqueryui.com/dialog/#default
See this code for jquery ui dialog box https://jqueryui.com/dialog/#default
您必须创建一个对话框,像这样并通过AJAX提交您的值:
You will have to create a dialog like so and submit your value via ajax:
<script>
$(function() {
$('#myButton').click(function(){
$('#dialog').dialog('open');
});
$( "#dialog" ).dialog({
autoOpen: false,
buttons: {
"OK": function() {
$.ajax({
url: '@Url.Action("myAjaxMethodAction", "myController")',
type: 'post',
data: $('#myForm').serialize(),
success: function() {
$('#dialog').dialog('close');
}
});
}
}
});
});
</script>
<div id="dialog" title="Basic dialog">
<form id="myForm">
<textarea id="myTextArea"></textarea>
</form>
</div>
另外,你可以把你的文字区域剃刀形式,只是提交页面提交上这将张贴到正规MVC的行动,就像您定期。
Alternatively, you could put your text area in a Razor form and just submit the page on submit which would post it to a regular MVC action like you would regularly.
这篇关于如何显示在MVC DOTNET的提交按钮的textarea弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!