首页 > 解决方案 > 引导模式正在打开但未显示任何数据

问题描述

在我的页面内,我有一个带有编辑按钮的网格。当我按下该按钮时,我必须获取其详细信息数据,然后我需要在引导模式中显示这些数据。

首先让我向您展示模态,

<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;
    }

现在一切都按预期工作,模式正在显示但没有显示任何数据..请帮助我。感谢和问候 在此处输入图像描述

在此处输入图像描述

标签: asp.netbootstrap-modal

解决方案


我已经解决了我的问题,

首先将模态内容包装在这样的更新面板中,

<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 不起作用?

此链接将帮助您解决该问题。


推荐阅读