views:

49

answers:

3

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.

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
Sorry, but this does not work for me :(
dani
A: 

MasterPage:

<asp:TextBox id="txtUsername" runat="server"></asp:TextBox>

Content Code Behind:

string username = ((TextBox)Master.FindControl("txtUsername")).Text;
JumpingJezza
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