Reputation: 3
I am working with a web form application that I created using the visual studio template. The template has a content placeholder that is replaced by the content of whatever page is being accessed. The page in question that is having problems has a couple of server controls such as textboxes, labels, and buttons. When I click my update button it works normally, the values postback and I update my database.
I wanted to create a login prompt universal across all of my child pages. My nav bar, which resides in my master page, is of a bootstrap setup. I added a dropdown list item to the nav bar where I placed a web user control that housed a form for logging in. Once I added the web user control, the onclick events no longer trigger and I am also having problem with validation for the control (error saying invalid postback or argument callback). I switched off event validation in my web config and I solved the one issue of the control not working but now I am still having problems with the onclick events not triggering. Any ideas what I might be missing here?
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a id="loginIcon" href="#" class="dropdown-toggle" data-toggle="dropdown" runat="server">Login<b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<LoginUserControl:Login ID="loginFormControl" runat="server"/>
</li>
</ul>
</li>
</ul>
<form id="login">
<div class="login-content" id="loginContainer" runat="server">
<fieldset id="inputs">
<asp:TextBox ID="txtUserName" runat="server" placeholder="Your username" required="true"></asp:TextBox>
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" placeholder="Password" require="true"></asp:TextBox>
</fieldset>
<fieldset id="actions">
<asp:Button ID="btnLogin" CssClass="submit" runat="server" Text="Login" OnClick="checkUser"></asp:Button>
<%--<asp:CheckBox ID="chkRemember" runat="server" Checked="true"></asp:CheckBox>Remember me--%>
</fieldset>
<%--<a href="#" style="float: right;">Forgot password?</a>
<a href="#">Sign up</a>--%>
</div>
<div class="login-content" id="logoutContainer" visible="false" runat="server">
<fieldset id="logoutAction">
<asp:Button ID="btnLogout" CssClass="submit" runat="server" Text="Logout" OnClick="logoutUser"></asp:Button>
</fieldset>
</div>
<div class="w3-half">
<div class="w3-row-padding">
<asp:Label ID="setPointsLbl" Text="Setpoints" CssClass="controlsLlb" runat="server"></asp:Label>
</div>
<div class="w3-row-padding">
<asp:Label Text="High:" runat="server"></asp:Label>
<asp:TextBox CssClass="controlsTb" ID="highSetPoint" runat="server"></asp:TextBox>
</div>
<div class="w3-row-padding">
<asp:Label Text="Low:" runat="server"></asp:Label>
<asp:TextBox CssClass="controlsTb" ID="lowSetPoint" runat="server"></asp:TextBox>
</div>
<div class="w3-row-padding">
<asp:Button ID="updateBtn" CssClass="btn btn-default rightFloat" Text="Update" OnClick="UpdateSetPoints" runat="server" />
</div>
</div>
The code above shows my master page adding the user control to the list, the html in the user control, and then some of the html in my child page.
Upvotes: 0
Views: 690
Reputation: 322
this is happening because you have 2 form elements in the page. In asp.net, only 1 form is allowed throughout the site (master and child page). What to do. Remove the form id=login
Upvotes: 1