Liste Modell razor-Ansicht

Ich habe eine Anwendung asp.net mvc . im controller habe ich dieses:

 public ActionResult Index()
        {
            Upload.Models.ClientModels model1 = new Models.ClientModels();
            ArrayList client = model1.Client_List();

            Upload.Models.AkeoModels model2 = new Models.AkeoModels();
            ArrayList akeo = model2.Akeo_List();


            ArrayList model = new ArrayList();
            model.Add(client);
            model.Add(akeo);
            return View(model);




        }

Ich an zwei verkettete Liste, um die Ansicht Index als Modell:

@{
    ViewBag.Title = "Bienvenue";
    int i = 0;
}

<hgroup class="title">
    <h1 style="color:darkcyan">Liste des clients</h1>
</hgroup>

<section >

<form>


<table style="margin-top: 50px;">
    <tr ><td ></td>
        <td ><center><b>Login</b></center></td>
        <td><center><b>Email</b></center></td>
        <td><center><b>Password</b></center></td>
        <td><center><b>Name</b></center></td>

    </tr>
    @{
        Upload.Models.ClientModels client = null;
        int j = 0;
        while( j != -1)
    {
        try
        {
            client = Model[j];
          <tr>
        <td width=10px>
            @if (i == 0)
            {
      <input type="radio" 
        name="color" checked >
            }
            else
            {<input type="radio"  name="color" >
            }      
    </td>
    <td>
      <a type="text" 
        name="color" >@client.Login</a>
    </td>

    <td>
      <a type="text" 
        name="color" >@client.Mail</a>
    </td>
      <td>
      <a type="text" 
        name="color" >@client.Password</a>
    </td>
      <td>
      <a type="text" 
        name="color" >@client.Name</a>
    </td>
  </tr>
            i++;
            j++;
        }
        catch {j = -1;}
    }
        i = 0;
    }

</table>

</form>

</section>

<section style="margin-top: 30px">

    <a type="button"   style="width:120px;display:inline-block; height:20px;text-decoration:none;color:white;text-align:center;background-color:darkcyan;padding:5px;border-style:outset;border-width:2px;border-color:darkcyan;margin-left:150px"  href="@Url.Action("Delete_client", "Admin")">Supprimer</a>
    <a type="button" style="width:120px;display:inline-block; height:20px;text-decoration:none;color:white;text-align:center;background-color:darkcyan;padding:5px;border-style:outset;border-width:2px;border-color:darkcyan;" href="@Url.Action("Edit_client", "Admin",new { Id = 1 })">Editer</a>
    <br /> <br />
     <a href="@Url.Action("Create","Client")" style="color:blue; margin-top : 30px;margin-left:150px">Créer un nouveau compte</a>

    </section>
    <br />
<section>
<hgroup class="title">
    <h1 style="color:darkcyan">Liste des akeos</h1>
</hgroup>

<section >

<form>


<table style="margin-top: 50px;">
    <tr ><td ></td>
        <td ><center><b>Login</b></center></td>
        <td><center><b>Email</b></center></td>
        <td><center><b>Password</b></center></td>
        <td><center><b>Name</b></center></td>

    </tr>
     @{
        Upload.Models.AkeoModels akeo = null;
        int k = 0;
        while( k < Model.Count)
    {
        try
        {
            akeo = Model[k];

  <tr>
        <td width=10px>
            @if (i == 0){
      <input type="radio" 
        name="color" checked >
            }
            else{<input type="radio"  name="color" >
            }      
    </td>
    <td>
      <a type="text" 
        name="color" >@akeo.Login</a>
    </td>

    <td>
      <a type="text" 
        name="color" >@akeo.Mail</a>
    </td>
      <td>
      <a type="text" 
        name="color" >@akeo.Password</a>
    </td>
      <td>
      <a type="text" 
        name="color" >@akeo.Name</a>
    </td>
  </tr>
         i++;
            k++;
        }
        catch {k++;}
    }
    }
</table>
</form>

</section>






 <section style="margin-top: 30px">


    <a type="button"   style="width:120px;display:inline-block; height:20px;text-decoration:none;color:white;text-align:center;background-color:darkcyan;padding:5px;border-style:outset;border-width:2px;border-color:darkcyan;margin-left:150px"  href="@Url.Action("Delete_akeo", "Admin",new { Id = 1})">Supprimer</a>
    <a type="button" style="width:120px;display:inline-block; height:20px;text-decoration:none;color:white;text-align:center;background-color:darkcyan;padding:5px;border-style:outset;border-width:2px;border-color:darkcyan;" href="@Url.Action("Edit_akeo", "Admin",new { Id = 1 })">Editer</a>
    <br /> <br /> <br />
     <a href="@Url.Action("Create","Akeo")" style="color:blue; margin-top : 30px;margin-left:150px">Créer un nouveau compte</a>

    </section>

    </section>

Das problem ist : die Werte der Liste nicht angezeigt . in der view-Index nur die labels und die buttons unterhalb der Tabellen werden angezeigt, aber der Inhalt des Modells nicht. ich bin Debuggen Sie das Programm und das Modell ist nicht leer, es enthält zwei Elemente.

  1. Wo ist der Fehler in der Ansicht?
  2. Wie kann ich es beheben?

InformationsquelleAutor Lamloumi Afif | 2013-05-21

Schreibe einen Kommentar