Hi,
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.
views:
49answers:
3
A:
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 http://stackoverflow.com/questions/564289/read-post-data-submitted-to-asp-net-form for some details on reading the data with that server side page.
JoshD
2010-10-05 06:56:46
Sorry, but this does not work for me :(
dani
2010-10-05 07:25:25
A:
MasterPage:
<asp:TextBox id="txtUsername" runat="server"></asp:TextBox>
Content Code Behind:
string username = ((TextBox)Master.FindControl("txtUsername")).Text;
JumpingJezza
2010-10-05 08:22:10
A:
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
2010-10-05 08:46:49