Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET按钮单击事件在引导模式下未触发_C#_Asp.net_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

C# ASP.NET按钮单击事件在引导模式下未触发

C# ASP.NET按钮单击事件在引导模式下未触发,c#,asp.net,twitter-bootstrap,modal-dialog,C#,Asp.net,Twitter Bootstrap,Modal Dialog,我正在我的网站上使用引导。在这种情况下,单击注册按钮时会弹出注册模式。它有一些字段、一个注册按钮和一个关闭按钮。 他们的代码是 <div id="myModalRegister" runat="server" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header

我正在我的网站上使用引导。在这种情况下,单击注册按钮时会弹出注册模式。它有一些字段、一个注册按钮和一个关闭按钮。 他们的代码是

<div id="myModalRegister" runat="server" class="modal hide fade" tabindex="-1"
 role="dialog" aria-labelledby="myModalLabel"
    aria-hidden="true">
    <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
            ×</button>
        <h3 id="H1">
            Register</h3>
    </div>
    <div class="modal-body">

    <i class="icon-user"></i>Email ID</label>
        <input type="text" class="span3" id="txtRegEmail" runat="server" />
        <br />
    </div>

    <div class="modal-footer">
        <button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">
            Close</button>
        <asp:Button ID="btRegister" runat="server" CssClass="btn btn-primary" 
            Text="Register" onclick="btRegister_Click" />
    </div>
</div>

×
登记
电子邮件ID

接近
当我点击btRegister按钮时,点击事件没有触发。你能帮我吗


经过一些研究,我发现模态窗口是在
表单
标记之外呈现的。这就是为什么事件没有发生。如何解决这个问题?

我认为您有两个选择:

  • 将按钮放在标记内(您不需要将模态放在表单标记外)
  • 使用启用javascript的按钮而不是服务器端控件

  • 今天我遇到了同样的问题,发现我的按钮ID与表单中的另一个按钮相同,请尝试检查您没有具有相同ID的另一个按钮,然后它将像老板一样工作

    解决这个问题的唯一方法是将按钮放在表单中。还可以将文本框放在其中,以便后面的代码可以看到其中的数据。可以使用jquery捕获按钮单击,然后从javascript调用回发单击事件吗。下面是有关如何执行此操作的stackoverflow参考:
    <li class="one"><a href="#myModalRegister" role="button" data-toggle="modal" >
           <i class="icon-user icon-white"></i> Sign Up</a></li>