循环输出ViewBag集合

<tr>
            <td>
                权限分配:
            </td>
            <td>
                <table id="table1">
                    @{
                    
                        var userGroupArray = ViewBag.UserGroupLogSyslist as IList<UserGroupLogSys>;

if (userGroupArray != null && userGroupArray.Count > 0)
                        {

double userGroupCount = (userGroupArray.Count() * 1.0) / 5;
                            int iCount = (int)Math.Ceiling((decimal)userGroupCount);
                            int num = 0;
                            int jnum = 0;
                            for (int j = 0; j < iCount; j++)
                            {

jnum = num;
                            
                        <tr>
                            @for (int i = num; i < userGroupArray.Count; i++)
                            {

if (num % 5 == 0 && num != jnum)
                                {
                                    break;
                                }
                                else
                                {
                              
                                <td>
                                    <input type="checkbox" value="@userGroupArray[i].ID" name='checkboxs'/>
                                    @userGroupArray[i].userGroupFlag _ @userGroupArray[i].LogSys _ @userGroupArray[i].CompanyName
                                </td>
                                    
                                }

num++;

}
                        </tr>
                            
                            }
                        }
                    }
                </table>
            </td>
        </tr>

上一篇:C#反射、方法调用、自动调用方法、根据按钮名称调用方法、C#按钮权限管理


下一篇:HTML DOM 事件对象