Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4045190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:23:25+00:00 2026-05-20T13:23:25+00:00

A friend and i are trying to make a site, where, a user can

  • 0

A friend and i are trying to make a site, where, a user can create/edit/delete countries, and by clicking on a link next to a country takes the user to a list of the zipcodes in that country. we kinda fail in this, so we hope someone can help us figure out what we are doing wrong.

our code is as follows:

ISOerController.cs

using SkarpSpedition.Models;

using System;
using System.Linq;
using System.Web.Mvc;


namespace SkarpSpedition.Controllers
{
    public class ISOerController : Controller
{
    ISODBContext db = new ISODBContext();

    public ActionResult Index()
    {
        var ISOer = from i in db.ISOes
                    orderby i.Sted ascending
                    select i;
        return View(ISOer.ToList());
    }
    public ActionResult GåTilPostdistrikter(int id)
    {
        return Redirect(@"../../Postdistrikter/" + id);
    }
    ...
}
}

Index.cshtml of the view ISOer

@model IEnumerable<SkarpSpedition.Models.ISO>
@{
ViewBag.Title = "ISO-Koder";
}

<h2>
ISO-Kode Oversigt</h2>
<p>
@Html.ActionLink("Opret ny", "Create")
</p>
<table>
<tr>
    <th>
        Sted
    </th>
    <th>
        Alph2
    </th>
    <th>
        Alph3
    </th>
    <th>
        Numc
    </th>
    <th>
    </th>
</tr>
@foreach (var item in Model)
{
    <tr>
        <td>
            @item.Sted
        </td>
        <td>
            @item.Alph2
        </td>
        <td>
            @item.Alph3
        </td>
        <td>
            @item.Numc
        </td>
        <td>@Html.ActionLink("Postdistrikter", "GåTilPostdistrikter", new { id = item.ID }) |
            @Html.ActionLink("Rediger", "Edit", new { id = item.ID }) |
            @Html.ActionLink("Slet", "Delete", new { id = item.ID })
        </td>
    </tr>
}
</table>

PostdistrikterController.cs

using SkarpSpedition.Models;

using System;
using System.Linq;
using System.Web.Mvc;

namespace SkarpSpedition.Controllers
{
public class PostdistrikterController : Controller
{

    PostdistriktDBContext db = new PostdistriktDBContext();

    public ActionResult Index(int id)
    {
        var Postdistrikter = from p in db.Postdistrikts
                             where p.Iso_id == id
                             orderby p.Postnummer ascending
                             select p;

        return View(Postdistrikter.ToList());
    }


}
}

Index.cshtml of the view Postdistrikter

@model IEnumerable<SkarpSpedition.Models.Postdistrikt>
@{
    ViewBag.Title = "Index";
}
<h2>
    Postdistrikts oversigt</h2>
<p>
    @Html.ActionLink("Opret ny", "Create")
</p>
<table>
    <tr>
        <th>
            Postnummer
        </th>
        <th>
            Bynavn
        </th>
        <th>
            Adresse
        </th>
        <th>
            Land
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    { 
        <tr>
            <td>
                @item.Postnummer

            </td>
            <td>
                @item.Bynavn
            </td>
            <td>
                @item.Adresse
            </td>
            <td>
                @item.Iso_id
            </td>
            <td>
                @Html.ActionLink("Rediger", "Edit", new { id = item.ID }) |
                @Html.ActionLink("Slet", "Delete", new { id = item.ID })
            </td>
        </tr>
    }
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:23:26+00:00Added an answer on May 20, 2026 at 1:23 pm

    You should be using RedirectToAction, not Redirect.

    public ActionResult GåTilPostdistrikter(int id)
    {
        return RedirectToAction( "index", "Postdistrikter", new { id = id } );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to hide my Add friend link if - current_user and @user
I am trying to make a form which my friend can enter information and
I have a friend who is trying to make the switch to Linux, but
I'm trying to make my app publish to all my friend's walls. From what
My friend is trying to create a utility function that is given some Type
I am trying to help a friend of mine break his site out of
Me and my friend are trying to make a webpage which has a flash
I'm trying to make a web interface for a c++ game a friend have
I trying to make a tell a friend script. The script must send an
im trying to make facebook upload photo with random tag friend. the program was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.