asp.net - 引导模式正在打开但未显示任何数据
问题描述
在我的页面内,我有一个带有编辑按钮的网格。当我按下该按钮时,我必须获取其详细信息数据,然后我需要在引导模式中显示这些数据。
首先让我向您展示模态,
<div id="template" class="modal fade ui-draggable ui-draggable-handle in" role="dialog" aria-hidden="true" tabindex="-1"
style="overflow-y: hidden; padding-left: 16px;">
<div class="modal-dialog setting-modal-dialog" style="width: 82% !important; margin-top: 2px !important;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×
</span>
</button>
<h4 class="modal-title">Edit
</h4>
</div>
<div class="modal-body" style="padding: 0">
<div class="template-content" id="div01" style="">
<div id="divTemplateCreatesettings" class="fieldset01">
<table class="quiz-template-table">
<tbody>
<tr>
<td class="title">Header Text
</td>
<td class="title-data">
<asp:TextBox runat="server" ID="txtHeaderText" Width="326px" ClientIDMode="Static">
</asp:TextBox>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
现在让我告诉你我是如何调用这个模态的,
protected void btnEdit_OnClick(object sender, EventArgs e){
//calling and displaying data..
// No issue here..
// calling Modal..
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "key00",
"openModal('');",
true);
}
function openModal(sender, args) {
debugger;
$('#template').modal('show');
return false;
}
解决方案
我已经解决了我的问题,
首先将模态内容包装在这样的更新面板中,
<div id="template" class="modal fade ui-draggable ui-draggable-handle in" role="dialog" aria-hidden="true" tabindex="-1"
style="overflow-y: hidden; padding-left: 16px;">
<div class="modal-dialog setting-modal-dialog" style="width: 82% !important; margin-top: 2px !important;">
<asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
// .. rest of the code..
<div class="modal-content">
并在打电话时
事件处理程序
{
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "key00",
"openModal('');",
true);
upModal.Update();
}
现在它将绑定数据,但还有另一个问题,如果存在任何对任何类型的工作负责的脚本现在都不会工作.. 因为: 为什么在 asp.net 中触发 Updatepanel 后 Javascript 不起作用?
此链接将帮助您解决该问题。
推荐阅读
- python - Django如何只为登录用户获取所有产品?
- datetime - 如何在 Dart 和 Flutter 中将时间舍入到最近的一刻钟?
- javascript - 本地组件数据在不应该更改 Vuex 状态时更改
- javascript - 从对象数组中删除重复项 - Javascript
- android - android中(未知url)0未知错误android的http失败响应?
- javascript - 在节点 js 中安装 udev 模块时出错
- ios - 如何知道在我们的快捷方式应用程序中添加了特定快捷方式还是不使用我们的 iOS 应用程序?
- android - “adb shell am start -S -W PackageName/.MainActivity”命令不显示时间输出?
- json - 如何通过 NRF24L01 传感器发送和解析 JSON 数据?
- python - 如何匹配给定字符串中的特定行