title: passing values from view to Controller N then to other View
body: Customer:
  
          
  
          
  
       
  
  <pre><code>&lt;p&gt;&lt;/p&gt;
  &lt;p&gt;&lt;/p&gt;
  &lt;div&gt; &lt;% foreach (var item in Model)
           { %&gt;
           You are viewing Users of Customer: &lt;%:item.Customer %&gt;
           &lt;%break; %&gt;
           &lt;%} %&gt;&lt;/div&gt;
      &lt;p&gt;&lt;/p&gt;
      &lt;% Html.RenderPartial("EditUsers", Model); %&gt;
  
  &lt;p&gt;
      &lt;%: Html.ActionLink("Create New", "Create", "Profile", null, null)%&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Now i got to pass the &lt;%:item.Customer %> through the %: Html.ActionLink("Create New", "Create", "Profile", null, null)%>  and that should be displayed in the Create view 
  here is the Controller n i will give the Create view too</p>
  
  <p>Controller:
  public ActionResult Create()
          {
              return View();
          }</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(string UserName, string Password, string FirstName, string LastName,
          string MiddleInitial,  string Email,string Telephone,  bool IsAdmin, bool IsSubAdmin)
      {
          UserDAL userDALObject = new UserDAL();
          tblUser newUser = new tblUser();
  
          newUser.Customer = customerNumber; 
          newUser.UserName = UserName;
          newUser.Password = Password;
          newUser.FirstName = FirstName;
          newUser.LastName = LastName;
          newUser.MiddleInitial = MiddleInitial;
          newUser.Email = Email;
          newUser.Telephone = Telephone; 
  
          newUser.IsAdmin = IsAdmin;
          newUser.IsSubAdmin = IsSubAdmin;
  
          userDALObject.AddUserDetails(newUser);
          TempData["UserCreationMsg"] = string.Format("User named :{0}, is created",UserName);
          return View();
      }
      public ActionResult EditUser(string id)
      {
          UserDAL userDALObject = new UserDAL();
          tblUser userDetails = userDALObject.GetUser(Int32.Parse(id));
          TempData["EditUserId"] = id;
          return View(userDetails);
      }
  </code></pre>
  
  <p>the Create View
  &lt;%if(TempData["UserCreationMsg"] != null)%>
      &lt;%{ %>
          &lt;%: TempData["UserCreationMsg"].ToString()  %>
      &lt;%} %></p>
  
  <pre><code>&lt;% using (Html.BeginForm()) {%&gt;
      &lt;%: Html.ValidationSummary(true) %&gt;
  
      &lt;fieldset&gt;          
  
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.UserName) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("UserName") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.UserName) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.Password) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.Password("Password") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.Password) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.FirstName) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("FirstName") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.FirstName) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.LastName) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("LastName") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.LastName) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.MiddleInitial) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("MiddleInitial") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.MiddleInitial) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.Email) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("Email") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.Email) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.Telephone) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.TextBox("Telephone") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.Telephone) %&gt;
          &lt;/div&gt;           
  
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.IsAdmin) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.CheckBox("IsAdmin") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.IsAdmin) %&gt;
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              &lt;%: Html.LabelFor(model =&gt; model.IsSubAdmin) %&gt;
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              &lt;%: Html.CheckBox("IsSubAdmin") %&gt;
              &lt;%: Html.ValidationMessageFor(model =&gt; model.IsSubAdmin) %&gt;
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;input type="submit" value="Create" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  </code></pre>