Multiple Actions (Forms) on one Page - How not to lose master data, after editing detail data?
- by nWorx
Hello all,
I've got a form where users can edit members of a group.
So they have the possibilty to add members or remove existing members. So the Url goes like
".../Group/Edit/4" Where 4 is the id of the group.
the view looks like this
<% using (Html.BeginForm("AddUser", "Group")) %>
<%{%>
<label for="newUser">User</label>
<%=Html.TextBox("username")%>
<input type="submit" value="Add"/>
</div>
<%}%>
<% using (Html.BeginForm("RemoveUser", "Group")) %>
<%{%>
<div class="inputItem">
<label for="groupMember">Bestehende Mitglieder</label>
<%= Html.ListBox("groupMember", from g in Model.GetMembers() select new SelectListItem(){Text = g}) %>
<input type="submit" value="Remove" />
</div>
<%}%>
The problem is that after adding or removing one user i lose the id of the group. What is the best solution for solving this kind of problem?
Should I use hidden fields to save the group id?
Thanks in advance.