0

ok i'm new to bootstrap themes and all. I have downloaded a bootstrap template for the internet and trying to edit it for my personal project. I'm running it on asp.net framework. I want to add some action when a bootstrap button is clicked in the cs file but can't find the way. In the aspx file the button is declared as below:

<div class="form-group">
                            <button type="submit" name="login" class="btn btn-primary btn-lg" required="required">Log In</button>
                        </div>

now I want to write some code about what should happen when this button is clicked but can't figure out how to do.

3
  • Since your button is inside a form tag, you page will be submitted. In Page_Load you can check out the paramenters from you form and do any action you want Commented Nov 13, 2015 at 11:10
  • can you explain in a bit detail Commented Nov 13, 2015 at 11:21
  • I think you probably have your submit button inside a form tag, like this: <form action="YourPage.aspx"> ...... <button type="submit" name="login" class="btn btn-primary btn-lg" required="required">Log In</button> ....... </form>. When you click the button, the page will be posted and the Form_Load method of your aspx.cs file will be hit. There you can handle any actions you want Commented Nov 13, 2015 at 11:34

1 Answer 1

1

Just do like this:

<asp:Button ID="btnLogin" runat="server" class="btn btn-primary btn-lg" OnClick="btnLogin_Click" Text="Log in" />

You are pointing the class, so it seams to be the same

Sign up to request clarification or add additional context in comments.

3 Comments

It doesn't work. I wrote the function in the cs file for btnLogin_Click. no output
do u use TeamViewer? If yes, I would like to connect to your computer and help you
i am afraid i don't but i can download it now and let you know when it's done. It will be really helpful

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.