bootstrap 父页面怎么向弹出的模态窗体传值或者对象

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bootstrap 父页面怎么向弹出的模态窗体传值或者对象相关的知识,希望对你有一定的参考价值。

参考技术A 22down voteaccepted

1 think you can do is to get rid of all those onclick attributes and do it the right way with bootstrap. You dont need to open them manually you can specify the trigger and even subscribe to events before the modal opens so that you can do your operations and populate data in it.
I am just going to show as a static example which you can accomodate in your real world.
on each of your tr's add a data attribute for id. i.e data-id with the corresponding id value and specify a data-target which is a selector you specify so that when clicked on it bootstrap will select that element as modal dialog and show it. And then you need to add another attribute data-toggle=modal to make this a trigger for modal.
<tr data-toggle="modal" data-id="1" data-target="#orderModal">
<td>1</td>
<td>24234234</td>
<td>A</td>
</tr>
<tr data-toggle="modal" data-id="2" data-target="#orderModal">
<td>2</td>
<td>24234234</td>
<td>A</td>
</tr>
<tr data-toggle="modal" data-id="3" data-target="#orderModal">
<td>3</td>
<td>24234234</td>
<td>A</td>
</tr>

and now in the javascript just set up the modal just once and event listen to its events so you can do your work.
$(function()
$('#orderModal').modal(
keyboard: true,
backdrop: "static",
show:false,

).on('show', function() //subscribe to show method
var getIdFromRow = $(event.target).closest('tr').data('id'); //get the id from tr
//make your ajax call populate items or what even you need
$(this).find('#orderDetails').html($('<b> Order Id selected: ' + getIdFromRow + '</b>'))
);
);

winform 怎么让子窗体显示在主窗体上?

一个管理窗体 点按钮后 弹出的子窗体 要显示在主窗体的上面 不能重新打开一个窗体 (像 Web的母版页) 该怎么实现 !!!!

mdi子窗体肯定是现实在父窗体的里面,你说的上面是什么意思?只能打开同一个子窗体的代码:private bool isIn(Form f)

foreach (Form fr in this.MdiChildren)

if (fr.GetType() == f.GetType())
return true;

return false;
把子窗体传进去即可
参考技术A private void 图书信息维护ToolStripMenuItem_Click(object sender, EventArgs e)

FrmBookInfo1122 nf = new FrmBookInfo1122();
nf.MdiParent = this;
nf.WindowState = FormWindowState.Maximized;//就是这个嘛?
nf.Show();
参考技术B 新建一个实例。
实例.ShowDialog()
private void 图书信息维护ToolStripMenuItem_Click(object sender, EventArgs e)

FrmBookInfo1122 nf = new FrmBookInfo1122();
nf.MdiParent = this;
nf.WindowState = FormWindowState.Maximized;//就是这个嘛?
nf.Show();

以上是关于bootstrap 父页面怎么向弹出的模态窗体传值或者对象的主要内容,如果未能解决你的问题,请参考以下文章

C# 模态框传值

bootstrap 模态框 modal 插件在一个含有多个页面

js中怎么获取bootstrap datetimepicker 弹出的位置

Bootstrap模态对话框怎么隐藏?

bootstrap模态框怎么传值

bootstrap模态框背景灰色,按钮全部无法点击,求解决办法