使用不同的选项将同一张表显示给不同的角色

时间:2019-01-10 20:57:06

标签: asp.net

当前,我只是在每个角色的不同页面中张贴相同的代码,一个具有此类表的转发器,但每个角色都有不同的选择。我试图将其放置在loginview分隔符中,但是没有用,我不知道如何通过登录视图控件进行迭代,并且代码开始变得比仅做visible = false / true更脏。除了制作新页面,还有没有更有效的方法?

 <asp:Repeater ID="rptArtigos" runat="server" OnItemCommand="rptArtigos_OnItemCommand" OnItemDataBound="rptArtigos_OnItemDataBound">
                            <HeaderTemplate>
                                <table id="tblArtigos" class="table table-bordered dataTable text-center">
                                    <thead class="thead-dark">
                                        <tr>
                                            <th>ID</th>
                                            <th>Ref. Cliente</th>
                                            <th>Ref. Interna</th>
                                            <th>Nome</th>
                                            <th>Estado</th>
                                            <th>Válido Logística</th>
                                            <th>Data Criação</th>
                                            <th></th>
                                            <th></th>
                                            <th id="cell1" runat="server"></th>
                                            <th></th>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tbody>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblIdArtigo" runat="server" Text='<%# Eval("IdArtigo") %>' />
                                        </td>
                                        <td>
                                            <asp:Label ID="lblRefCliente" runat="server" Text='<%# Eval("ReferenciaCliente") %>' />
                                        </td>
                                        <td>
                                            <asp:Label ID="lblRefInterna" runat="server" Text='<%# Eval("ReferenciaInterna") %>' />
                                        </td>
                                        <td>
                                            <asp:LinkButton ID="lkbtnNome" runat="server" Text='<%# Eval("Nome") %>' CommandName="Ver" CommandArgument='<%# Eval("IdArtigo") %>'></asp:LinkButton>
                                        </td>
                                        <td>
                                            <asp:Label ID="lblEstado" runat="server" Text='<%# Eval("EstadoArtigo") %>' />
                                        </td>
                                        <td>
                                            <asp:Label ID="lblAprovadoLogistica" runat="server" Text='<%# Eval("AprovadoLogistica") %>' />
                                        </td>
                                        <td>
                                            <asp:Label ID="lblDataCriacao" runat="server" Text='<%# Eval("DataCriacao") %>' />
                                        </td>
                                        <td class="text-center">
                                            <asp:ImageButton ImageUrl="/Images/Icones/copy.png" Width="25" runat="server" CommandName="Copiar" CommandArgument='<%# Eval("IdArtigo") %>' />
                                        </td>
                                        <td class="text-center">
                                            <asp:ImageButton ImageUrl="/Images/Buttons/edit.png" Width="25" runat="server" CommandName="Editar" CommandArgument='<%# Eval("IdArtigo") %>' />
                                        </td>
                                        <td class="text-center">
                                            <asp:ImageButton ImageUrl="/Images/Buttons/success.png" Width="25" runat="server" OnClientClick="return false;" data-toggle="modal" data-target="#validate" CommandName="Validar" CommandArgument='<%# Eval("IdArtigo") %>' />
                                        </td>
                                        <td class="text-center">
                                            <asp:ImageButton ImageUrl="/Images/Buttons/x-button.png" Width="25" runat="server" CommandName="Rejeitar" CommandArgument='<%# Eval("IdArtigo") %>' />
                                        </td>
                                    </tr>
                                </tbody>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>

0 个答案:

没有答案