5

I'm using Bootstrap in my website. In that a registration modal pops up when a signup button is clicked. It has some fields and a register button and a close button. Their code is

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

The Sign up Button is

<li class="one"><a href="#myModalRegister" role="button" data-toggle="modal" >
       <i class="icon-user icon-white"></i> Sign Up</a></li>

When I click on the btRegister button the Click event is not firing. Can you help me??

After some Research I found out that the Modal Window is rendered outside the Form Tag. and that is why the Event is not firing. How can I resolve this ???

2
  • 2
    The only way to resolve that would be to put the button inside the form. Also put the text boxes inside it so that your code behind can see the data inside them. Commented May 1, 2013 at 16:43
  • Can you use jquery to capture the button click and then call the postback click event from javascript. Here's a stackoverflow reference on how to do that: stackoverflow.com/questions/8771097/… Commented Aug 21, 2013 at 0:07

2 Answers 2

0

I think you have two options:

  1. put the button inside the tag (you don't need your modal to be outside of the form tag)
  2. use a javascript enabled button instead of a server side control
Sign up to request clarification or add additional context in comments.

Comments

0

I had this same issue today and found that my button ID was the same as another button within the form, try checking you do not have another button with the same ID, then it will work like a BOSS!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.