Multiple Actions (Forms) on one Page - How not to lose master data, after editing detail data?
Posted
by nWorx
on Stack Overflow
See other posts from Stack Overflow
or by nWorx
Published on 2010-03-31T09:23:54Z
Indexed on
2010/03/31
11:53 UTC
Read the original article
Hit count: 280
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.
© Stack Overflow or respective owner