2010-01-09 5 views
0

Здравствуйте, я не могу предопределить все значения флажков на экране. Позвольте мне объяснить, у меня есть 5 флажков, например, 2 улучшены не другие, мне нужен массив со всеми 5 флажками, включая 2 true и другие false Кто-то может мне помочь.Получить значение из флажка

в то же время я пытался сделать другую систему, я создал класс

public class PresenzaAO  
     ( 
      public List <Presenti> listapresenti = new List <Presenti>();  
      public string conteggiototale (get;)  
      public long idalunno (get;)  
      public string radio (get;)  
     )  

     public class Present  
     ( 
      public string presents{get;set;}  
     ) 
and then in the view I created this: 



<% Using (Html.BeginForm (ModificaPresenzaAlunno "," Presence ", FormMethod.Post))  
     (%>  
    <% = Html.Hidden ("conteggiototale" Viewdata [ "conteggiototale"])%>  
    <% = Html.Hidden (idalunno "Viewdata [" student "])%>  
    <table>  
     <tr>  
      <td>  
       <% = Html.Encode (nomealunno)%>  
      </ td>  
      <td>  
       <% = Html.Encode (cognomealunno)%>  
      </ td>  
      <%  
       if (Viewdata [ "conteggio_presenze"]. ToString() == Viewdata ["conteggiototale"]. ToString())  
       (%>  
      <td>  
       Absent  
       <input type = "radio" name = "radio" checked = "checked" id = "assente_"  
        onclick = "getassentemod (<% = Viewdata [" student "]%>, 0);" value = "true_assente" />  
        This  
       <input type = "radio" name = "radio" id = "presente_" value = "false_presente"  
        onclick = "getassentemod (<% = Viewdata [" student "]%>, 0);" />  
      </ td>  
      <% Int i = 0;%>  
      <% Foreach (var p in (List <PresenzaAlunnoOra>) Viewdata [ "presenze_alunno"])  
       ( 

        i + = 1;  

      %>  
      <td>  
       <input type = "checkbox" id = "check_ <% = Viewdata [" student "] %><%= i%>" value ="<%= i%> "name =" Present "  
        onclick = "modificapresenzaalunno (this);" />  
      </ td>  
      <%)%>  
      <%)  
       else  
       (%>  
      <td>  
       Absent  
       <input type = "radio" value = "false_assente" name = "radio" id = "assente_ <% = Viewdata [" student "]%>"  
        onclick = "getassentemod (<% = Viewdata [" student "]%>, 0);" />  
        This  
       <input type = "radio" value = "true_presente" name = "radio" checked = "checked" id = "presente_ <% = Viewdata [" student "]%>"  
        onclick = "getpresentemod (<% = Viewdata [" student "]%>, 0);" />  
      </ td>  
      <% Int i = 0;%>  
      <%  
       foreach (var p in (List <PresenzaAlunnoOra>) Viewdata [ "presenze_alunno"])  
       ( 
        i + = 1;  
        if (p.presente == true)  
        ( 
      %>  
      <td>  
       <input type = "checkbox" id = "check_ <% = Viewdata [" student "] %>,<%= i%>" name = "Present"  
        checked = "checked" value ="<%= i%> "onclick =" modificapresenzaalunno (this); "/>  
      </ td>  
      <%)  

        else  
        (%>  
      <td>  
       <input type = "checkbox" id = "check_ <% = Viewdata [" pupil "]%>,<%= i%> "value ="<%= i%>" name = "Present"  
        onclick = "modificapresenzaalunno (this);" />  
      </ td>  
      <%)%>  
      <%)%>  
      <%)%>  
     </ tr>  
    </ table>  
    <input type="submit" id="btnupdatealunni" value="modifica presenze" />  
    <%)%>  
</ asp: Content> 

места параметра контроллера присутствие PresenzaAO

Я прочитал все параметры, кроме флажка

+0

Имя Attribué вашего флажком содержит пробелы для цели? –

ответ

0

Нет, это не содержит пробелов, но я заметил, что в примере, размещенном на имя флажка, отсутствует что-то , скажем, что имя флажка должно быть таким:

<input type = "checkbox" id = "check_ <% = Viewdata [" pupil "]%>,<%= i%> "value ="<%= i%>" name = "Present [<% = i% >].presents" 
        onclick = "modificapresenzaalunno (this);" /> 

Но я не работаю даже

Смежные вопросы