We help IT Professionals succeed at work.
Get Started

ASP.net button click event in Site.Master

Murray Brown
Murray Brown asked
on
85 Views
Last Modified: 2020-03-12
Hi
In my ASP.net Site Master whose markup code is shown below I have the following button
     <button class="btn btn-primary" ID="btnGetStarted">Get started</button>
I want to run VB.net code behind this but when I double click on it it does not create a VB.net click event



<%@ Master Language="VB" AutoEventWireup="true" CodeBehind="Site.master.vb" Inherits="Office2Web.SiteMaster" %>

<!DOCTYPE html>

<html lang="en">
<head runat="server">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><%: Page.Title %> Office2Web Microsoft Office and Web Solutions</title>

    <asp:PlaceHolder runat="server">
        <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>

    <webopt:bundlereference runat="server" path="~/Content/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap" rel="stylesheet">
</head>
<body>
    <form runat="server">
        <asp:ScriptManager runat="server">
            <Scripts>
                <%--To learn more about bundling scripts in ScriptManager see https://go.microsoft.com/fwlink/?LinkID=301884 --%>
                <%--Framework Scripts--%>
                <asp:ScriptReference Name="MsAjaxBundle" />
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="bootstrap" />
                <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
                <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
                <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
                <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
                <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
                <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
                <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
                <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
                <asp:ScriptReference Name="WebFormsBundle" />
                <%--Site Scripts--%>
            </Scripts>
        </asp:ScriptManager>

        <!-- Navbar -->
        <nav class="navbar navbar-default">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand" runat="server" href="~/">
                        <img src="Resources/images/logo/office2web-logo.svg" alt="The Office2Web logo"/>
                    </a>
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-menu-collapse" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <div class="collapse navbar-collapse" id="main-menu-collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li><a runat="server" href="~/">Home</a></li>
                        <li><a runat="server" href="~/About">About</a></li>
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Services
                            <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a runat="server" href="~/Microsoft_Office_Solutions">Microsoft Office Solutions</a></li>
                                <li><a runat="server" href="~/Web_Applications">Web Applications</a></li>
                                <li><a runat="server" href="~/Combined_Web_And_Office">Combined Web & Office</a></li>
                                <li><a runat="server" href="~/Access_Services">Access Services</a></li>
                            </ul>
                        </li>
                        <li><a runat="server" href="~/Contact">Contact</a></li>
                    </ul>
                </div>
            </div>
        </nav>

        <script type="text/javascript">
            (function ($) {
                $(document).ready(function () {
                    $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function (event) {
                        event.preventDefault();
                        event.stopPropagation();
                        $(this).parent().siblings().removeClass('open');
                        $(this).parent().toggleClass('open');
                    });
                });
            })(jQuery);
        </script>

        <!-- Content -->
        <div class="container-fluid p-0">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
        </div>

        <!-- Footer -->
        <footer class="footer">
            <div class="container">
                <div class="footer-form">
                    <div class="row">
                        <div class="col-sm-12 col-md-6">
                            <h2>Get a free consultation</h2>
                                          <p>Initial consultation is free. Thereafter charges apply.</p>
                        </div>
                        <div class="col-sm-12 col-md-4">
                            <div class="form-group">
                                <input type="email" placeholder="Enter your email address" class="form-control" />
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2">
                            <button class="btn btn-primary" ID="btnGetStarted">Get started</button>
                        </div>
                    </div>
                </div>
                <hr />
                <div class="footer-bottom">
                    <div class="row">
                        <div class="col-sm-12 col-md-6">
                            <p>&copy; <%: DateTime.Now.Year %> - Office2Web Pty Ltd</p>
                        </div>
                    </div>
                </div>
            </div>
        </footer>
    </form>
</body>
</html>
Comment
Watch Question
Director, Information Systems
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE