This is what i want 2 form in my navigation bar.
First is for Search Box
second is for username and password.login button

problem is if i put search box and login in same form then it gives weird look and formation error.

Second
Now I want to use buttons in master page That needs to be run on server but can't run without 2nd form running on server.

Is there any alternative to use Textbox control button link button searchbox control without using <Form> Running on server.?

Here is the code

I'm using Bootstrap

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTTYPE HTML>
<html>

<head>


<title></title>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link href="Content/bootstrap.min.css" rel="Stylesheet" media="screen"/>


</head>
<body>
<nav class="navbar navbar-default" role="navigation" >
<div class="navbar-header">
<a class="navbar-brand" href="Default.aspx">Cafferia</a>
</div>
<div>
<form class="navbar-form navbar-left" role="search" runat="server">
<div class="form-group">
<asp:TextBox ID="SearchBox" class="form-control" placeholder="Search Box" runat="server"></asp:TextBox>
</div>
<button ID="SearchButton" type="submit" class="btn btn-default" runat="server" name="Search">
</button>
</form>
<form  class="navbar-form navbar-right" role="login" runat="server">
<div class="form-group">
<asp:TextBox ID="UserName" class="form-control" placeholder="UserName" runat="server"></asp:TextBox>
<asp:TextBox ID="Password" class="form-control" placeholder="UserName" runat="server"></asp:TextBox>
</div>
<div class="btn-group">
<button id="Login" type="submit" class="btn btn-group dropdown-toggle" data-toggle="dropdown" runat="server">Login<span class="caret" ></span>
</button>
</div>
</form>

</div>

</nav>
</body>

</html>

When developing in asp.net (web forms), the page can only have one form element. You need to place all of your controls within the one form element.

one alternative is to use an iframe for a second form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.