How to debug to know which procedure or table is running with Asp.Net

2

I've been in the new job for 10 days, and I'm having some difficulties - which is normal depending on the difficulty.

I have a Table inside a Repeater, which is fed by a Procedure.

How do I do with Debug, to find the Procedure that is running through this line?

<asp:HiddenField ID="hdfCdTipoUsuario" runat="server" Value='<%# Eval("CdTipoUsuario")%>' />

That's all repeater and table:

<asp:Repeater ID="rptGerenciaProcessos" runat="server" 
    onitemcommand="rptGerenciaProcessos_ItemCommand" 
    onitemdatabound="rptGerenciaProcessos_ItemDataBound">
    <HeaderTemplate>
    <table id="gerenciaProcessos">
    <thead>
        <tr>
            <th>Consultar processo</th>
            <th>Priorizar</th>
            <th>Priorizado</th>
            <th>Nº do processo</th>
            <th>Data de abertura</th>
            <th>Início da análise</th>
            <th>Término na análise</th>
            <th>Situação</th>
            <th>Grupo</th>
            <th>Cota</th>
            <th>Etapa</th>
            <th>Analista</th>
        </tr>
    </thead>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <asp:Button ID="btnConsultarProcessos" OnClick="btnConsultarProcessos_Click" runat="server" Text="Consultar processo" CommandName="ConsultaProcessoGestor" CssClass="acessos" />
            </td>
            <td>
                <asp:HiddenField ID="hdfCdProcesso" runat="server" Value='<%# Eval("CdProcesso")%>'/>
                <asp:HiddenField ID="hdfCdAnalise" runat="server" Value='<%# Eval("CdAnalise")%>' />
                <asp:HiddenField ID="hdfCdUsuario" runat="server" Value='<%# Eval("CdUsuarioAn")%>' />
                <asp:HiddenField ID="hdfCdWorkFlowItem" runat="server" Value='<%# Eval("CdWorkFlowItem")%>' />
                <asp:HiddenField ID="hdfCdTipoUsuario" runat="server" Value='<%# Eval("CdTipoUsuario")%>' />
                <asp:LinkButton ID="lkbPriorizar" runat="server" CssClass="clickPriorizar">Priorizar</asp:LinkButton>
                <!--<a href="#"class="clickPriorizar">Priorizar</a>-->
            </td>
            <td><input type="checkbox" id="ckbPriorizado" <%# Eval("IcPriorizado")%> disabled></td>
            <td><asp:Label Text='<%# Eval("CdProcesso")%>'      runat="server" /></td>
            <td><asp:Label Text='<%# Eval("DtCriacao")%>'       runat="server" /></td>
            <td><asp:Label Text='<%# Eval("DtInicio")%>'        runat="server" /></td>
            <td><asp:Label Text='<%# Eval("DtFim")%>'           runat="server" /></td>
            <td><asp:Label Text='<%# Eval("NmWorkFlowItem")%>'  runat="server" /></td>
            <td><asp:Label Text='<%# Eval("CdGrupo")%>'         runat="server" /></td>
            <td><asp:Label Text='<%# Eval("CdCota")%>'          runat="server" /></td>
            <td><asp:Label Text='<%# Eval("NmTipoStatus")%>'    runat="server" /></td>
            <td><asp:Label Text='<%# Eval("NomeUsuario")%>'     runat="server" /></td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </FooterTemplate>
</asp:Repeater>

The difficulty is in knowing how to debug the line ...Eval("Meu_Campo")...

    
asked by anonymous 21.11.2014 / 18:42

2 answers

1

The dynamic content of Repeater is typically loaded as follows:

rptGerenciaProcessos.DataSource = RetornaDados(parametro1, parametro2);
rptGerenciaProcessos.DataBind();

To find out which procedure is performed to feed Repeater, you must walk the path in reverse of what is set for DataSource .

The path may be more complicated if this assignment is not explicit in the code-behind of your page (usually [page_name] .aspx.cs). It may be calling a generic function from somewhere else to load the data:

CarregaRepeater(rptGerenciaProcessos, RetornaDados(parametro1, parametro2));

I advise you to search for RetornaDados(parametro1, parametro2) s in the source code of the page. If you do not find it, look for all occurrences of rptGerenciaProcessos . Use the "Find All".

About debugging Eval("Meu_Campo") :

This code snippet defines that the value in the "My_Column" column will go to this field of your page for each DataSource item. You can override this behavior through the OnItemDataBound event:

void rptGerenciaProcessos_ItemDataBound(Object Sender, RepeaterItemEventArgs e) {
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
        Processo item = (Processo)e.Item.DataItem;
        // Coloque um breakpoint aqui e analise a variável "item"
        if (Item.CdTipoUsuario == 5) {
            ((Label)e.Item.FindControl("hdfCdTipoUsuario")).Value = "50";
        }
    }
}  
    
21.11.2014 / 22:33
0

When you create a page your_page.aspx CodeBehind is created with its_page_name.cs and this is where your repeater is being loaded. Edit this page .cs and find rptGerenciaProcessos.DataSource in it will be the content of the data. Can be loaded by an object or by method execution. In the method that will be the name of the SP or SQl expression used for the load.

    
21.11.2014 / 22:08