I'm using ASP.NET MVC 2 technology for developing my web site. I have two input fields in my master page (username and password) and one submit button.
How can I get data from those input fields?
Please help.
Asked
Active
Viewed 1,063 times
1

dani
- 469
- 3
- 12
- 23
3 Answers
0
You should probably start at this page
When the form is submitted, it should direct to a server-side page that will process the data.
Check out Read Post Data submitted to ASP.Net Form for some details on reading the data with that server side page.
0
MasterPage:
<asp:TextBox id="txtUsername" runat="server"></asp:TextBox>
Content Code Behind:
string username = ((TextBox)Master.FindControl("txtUsername")).Text;

JumpingJezza
- 5,498
- 11
- 67
- 106
0
I found what i was looking for. Thank you for your answers.
<% using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) { %>
<%= Html.LabelFor(d => d.UserName)%>:
<%= Html.EditorFor(d => d.UserName)%>
<%= Html.LabelFor(d => d.Password)%>:
<%= Html.Password("Password")%>
<input type="submit" value="Login" />
<%= Html.ValidationSummary() %>
<% } %>

dani
- 469
- 3
- 12
- 23