<bdo id='L4wEV'></bdo><ul id='L4wEV'></ul>
  • <tfoot id='L4wEV'></tfoot>

    <small id='L4wEV'></small><noframes id='L4wEV'>

      <legend id='L4wEV'><style id='L4wEV'><dir id='L4wEV'><q id='L4wEV'></q></dir></style></legend>
      1. <i id='L4wEV'><tr id='L4wEV'><dt id='L4wEV'><q id='L4wEV'><span id='L4wEV'><b id='L4wEV'><form id='L4wEV'><ins id='L4wEV'></ins><ul id='L4wEV'></ul><sub id='L4wEV'></sub></form><legend id='L4wEV'></legend><bdo id='L4wEV'><pre id='L4wEV'><center id='L4wEV'></center></pre></bdo></b><th id='L4wEV'></th></span></q></dt></tr></i><div id='L4wEV'><tfoot id='L4wEV'></tfoot><dl id='L4wEV'><fieldset id='L4wEV'></fieldset></dl></div>

        单击提交按钮时,我的 ASPX 文件中的第二个模态不会发布

        时间:2023-10-06
      2. <legend id='UIBl3'><style id='UIBl3'><dir id='UIBl3'><q id='UIBl3'></q></dir></style></legend>

        <small id='UIBl3'></small><noframes id='UIBl3'>

        • <bdo id='UIBl3'></bdo><ul id='UIBl3'></ul>
              <tbody id='UIBl3'></tbody>
                1. <i id='UIBl3'><tr id='UIBl3'><dt id='UIBl3'><q id='UIBl3'><span id='UIBl3'><b id='UIBl3'><form id='UIBl3'><ins id='UIBl3'></ins><ul id='UIBl3'></ul><sub id='UIBl3'></sub></form><legend id='UIBl3'></legend><bdo id='UIBl3'><pre id='UIBl3'><center id='UIBl3'></center></pre></bdo></b><th id='UIBl3'></th></span></q></dt></tr></i><div id='UIBl3'><tfoot id='UIBl3'></tfoot><dl id='UIBl3'><fieldset id='UIBl3'></fieldset></dl></div>

                2. <tfoot id='UIBl3'></tfoot>
                  本文介绍了单击提交按钮时,我的 ASPX 文件中的第二个模态不会发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 ASPX 文件,其中包含两个模式(myModal 和 addModal)和一个 gridview,其中包含调用每个模式的按钮.我在打开并单击其提交按钮时遇到第二个模式的问题,因为它不会触发回发.它只是第二个的问题.如果我在 ASPX 文件中更改这些模式的顺序,那么我再次遇到文件中的第二个问题.

                  I have an ASPX file that contains two modals (myModal and addModal) and a gridview that has buttons calling each of these. I am having trouble with the second modal when opening and clicking its Submit button as it won't fire a PostBack. Its only a problem with the second one. If I change the sequence of these Modals within the ASPX file, then I again have trouble only with the second one in the file.

                  当在同一个 ASPX 页面中有两个模态框以使其触发 PostBack 时,是否需要额外的东西?

                  Is there something additional needed when having two modals in the same ASPX page to get it to fire a PostBack?

                  这里是 ASPX 和 C# 文件:

                  Here are the ASPX and C# files:

                  C# 文件:

                  protected void Page_Load(object sender, EventArgs e)
                  {                
                  try{
                      if (IsPostBack)
                      {
                          Control control = null;         
                          string controlName = Request.Params["__EVENTTARGET"];
                          if (!String.IsNullOrEmpty(controlName))
                          {
                              control = FindControl(controlName);
                              GridViewRow gvRow1 = (GridViewRow)control.Parent.Parent;
                              string controlID = control.ID.ToString();
                          }
                      }
                      if(!IsPostBack)
                      {
                              DataGrid_Load(DAL.reg(HeadText.Text, OrgText.Text), "reg");
                              ErrorText.Text = "NO POSTBACK";
                      }   
                  }
                  catch{}
                  }
                  

                  ASPX 文件:

                  <div id="myModal" class="modal fade">
                  <script type="text/javascript">
                          function openModal() {
                              $('[id*=myModal]').modal('show');
                          } 
                  </script>
                  <div class="modal-dialog modal-lg" role="document">
                      <div class="modal-content">
                          <div class="modal-header">
                              <h2 class="modal-title">Update Data</h2>
                          </div>
                          <div class="modal-body">        
                              <form class="form-inline" role="form" method="POST" action="" >
                                  <div class="control-group">
                                      <div class="controls controls-row">
                                          <label for="lblnameid" class="col-sm-2 control-label">Name</label>
                                          <div class="col-sm-6">
                                              <asp:TextBox ID="lblnameid" runat="server" Text="" CssClass="form-control" ></asp:TextBox>
                                          </div>
                                          <label for="rankid" class="col-sm-1 control-label">Rank</label>
                                          <div class="col-sm-3">
                                              <asp:DropDownList id="rankid" runat="server" CssClass="form-control"
                                                  SelectedValue='<%# Eval("rank") %>' TabIndex='<%# TabIndex %>'>
                                                  <asp:ListItem Value=""> </asp:ListItem>
                                                  <asp:ListItem Value="a"> A </asp:ListItem>
                                                  <asp:ListItem Value="b"> B </asp:ListItem>
                                                  <asp:ListItem Value="c"> C </asp:ListItem>
                                              </asp:DropDownList>
                                          </div>
                                      </div>
                                  </div>
                                      <p> </p>
                  
                                  <div class="control-group">
                                      <div class="col-sm-10">
                                          <asp:TextBox ID="id" type="hidden" runat="server" Text="" CssClass="form-control" ></asp:TextBox>
                                      </div>
                                  </div>                  
                  
                                  <div class="form-group">
                                      <div class="col-sm-offset-2 col-sm-10">
                                        <div class="pull-right">
                                          <button type="submit" class="btn btn-default">Cancel</button>
                                          <!-- <button type="submit" class="btn btn-primary">Save</button> -->
                                          <asp:Button ID="btnUpdate" OnClientClick="<% %>" class="btn btn-default" runat="server" Text="Save" CommandArgument='<%# Eval("Id") %>' OnCommand="btnUpdate_Click" />
                                        </div>
                                      </div>
                                  </div>
                              </form>
                          </div><!-- /.modal-body -->
                          <form role="form" action="">
                          <div class="modal-footer">
                          </div>
                          </form>
                      </div><!-- /.modal-content -->
                  </div><!-- /.modal-dialog -->
                  </div><!-- /.modal -->
                  
                  <div id="addModal" class="modal fade" tabindex="-1" method="POST" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                  <script type="text/javascript">
                  
                      $('#addModal').on('hidden.bs.modal', function () {
                          $(this).find('form').trigger('reset');
                      })
                  </script>
                  <div class="modal-dialog modal-lg" role="document">
                      <div class="modal-content">
                          <div class="modal-body">
                              <div class="row">
                                  <div class="col-md-12">
                                      <form class="form-horizontal" role="form">
                                          <fieldset>
                                              <div class="form-group">
                                                  <label class="col-sm-2 control-label" for="textinput">Name</label>
                                                  <div class="col-sm-6">
                                                    <input type="text" id="lblnameid" class="form-control">
                                                  </div>
                                              </div> 
                                          </fieldset>
                                      <div class="modal-footer">
                                          <asp:Button ID="btnSubmit" OnClientClick="<% %>" class="btn btn-primary" runat="server" Text="Save" CommandArgument='<%# Eval("Id") %>' OnCommand="btnSubmit_Click" />
                                      </div>
                                      </form>
                                  </div>  
                              </div>  
                          </div>  <!-- /.modal-body -->
                      </div>  <!-- /.modal-content -->
                  </div>  <!-- /.modal-dialog -->
                  

                  推荐答案

                  问题是我的页面中有 3 组表单标签.一个用于整个页面,一个用于我通过按钮单击打开的两个 Bootstrap 模态.当我从引导模式中删除表单标签时,解决方案就来了.然后来自模态的所有按钮点击都正常工作并提交了数据.

                  The problem was I had 3 sets of form tags in my page. One for the overall page and one each for the two Bootstrap Modals I had that opened up from button clicks. The solution came when I removed the form tags from the bootstrap modals. Then all button clicks from the modals worked properly and submitted the data.

                  这篇关于单击提交按钮时,我的 ASPX 文件中的第二个模态不会发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:.NET 中是否有等效的 Mac OS X 文档模式表? 下一篇:jQuery UI 的对话框在 ASP.NET 上不起作用

                  相关文章

                    <small id='mDDq5'></small><noframes id='mDDq5'>

                      <legend id='mDDq5'><style id='mDDq5'><dir id='mDDq5'><q id='mDDq5'></q></dir></style></legend>
                      • <bdo id='mDDq5'></bdo><ul id='mDDq5'></ul>
                      <tfoot id='mDDq5'></tfoot>
                      <i id='mDDq5'><tr id='mDDq5'><dt id='mDDq5'><q id='mDDq5'><span id='mDDq5'><b id='mDDq5'><form id='mDDq5'><ins id='mDDq5'></ins><ul id='mDDq5'></ul><sub id='mDDq5'></sub></form><legend id='mDDq5'></legend><bdo id='mDDq5'><pre id='mDDq5'><center id='mDDq5'></center></pre></bdo></b><th id='mDDq5'></th></span></q></dt></tr></i><div id='mDDq5'><tfoot id='mDDq5'></tfoot><dl id='mDDq5'><fieldset id='mDDq5'></fieldset></dl></div>