Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6753849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:12:39+00:00 2026-05-26T13:12:39+00:00

In Page_Load, I call a method that just lists some data that comes from

  • 0

In Page_Load, I call a method that just lists some data that comes from my database. But, if I navigate through my web site, and then return to this same link that just lists some data, the method doesn’t pass through the Page_Load, and then shows the old data values.

Why is my Page_Load called only once ?

My page_load

protected void Page_Load(object sender, EventArgs e)
{            
    this.CarregaList();
}

My CarregaList method

protected void CarregaList()
{
    Utilidade.Conexao con = new Utilidade.Conexao();
    dsChave.ConnectionString = con.Con;

    #region :::: Montando o Select da lista ::::

    //// Parametros do Usuário,podem ser pegos pelo token
    Utilidade.QuebraToken tk = new Utilidade.QuebraToken();

    int Acesso = Convert.ToInt32(tk.CarregaToken(15, Request.Cookies["token"].Value));
    int IdUsuario = Convert.ToInt32(tk.CarregaToken(0, Request.Cookies["token"].Value));
    int Celula = Convert.ToInt32(tk.CarregaToken(21, Request.Cookies["token"].Value));
    int Credenciada = Convert.ToInt32(tk.CarregaToken(1, Request.Cookies["token"].Value));

    StringBuilder sbSelect = new StringBuilder();

    string selectx = "SELECT top 10 San_Chave.Chave_Id, San_Chave.Usuario_Id, San_Chave.Credenciada_Id, San_Chave.Usuario_Id_Responsavel, San_Chave.DataHora, San_Chave.Transacao, " 
        + "San_Chave.Cliente_Id, San_Chave.DataHoraPegou, San_Chave.DataHoraDevolverPrevisao, San_Chave.DataHoraEntregou, San_Chave.HorasDevolucao, " 
        + "San_Chave.NomeResponsavel, San_Chave.CpfResponsavel, San_Chave.RgResponsavel, San_Chave.TelResponsavel, San_Chave.Tel2Responsavel, " 
        + "San_Chave.Endereco, San_Chave.Devolvido, San_Chave.TextoDevolucao, San_Usuario.NomeCompleto AS NomeUsuarioVenda, view_Cliente.NomeCliente " 
        + "FROM San_Chave " 
        + "JOIN San_Usuario " 
        + "ON San_Chave.Usuario_Id_Responsavel = San_Usuario.Usuario_Id "
        + "LEFT OUTER JOIN view_Cliente " 
        + "ON San_Chave.Cliente_Id = view_Cliente.Cliente_Id " 
        + "where (San_Chave.Devolvido = 0 or San_Chave.Devolvido is NULL) ";

    sbSelect.Insert(0, selectx);

    if (Acesso == 0)
    {
        sbSelect.Append(" and San_Chave.Credenciada_Id = " + Credenciada);
    }

    if (Request.QueryString["data"] != null)
    {
        sbSelect.Append(" and ( San_Usuario.NomeCompleto like '%" + Request.QueryString["data"].ToString() + "%' or San_Chave.DataHoraPegou like '%" + Request.QueryString["data"].ToString() + "%' or San_Chave.NomeResponsavel like '%" + Request.QueryString["data"].ToString() + "%' or view_Cliente.NomeCliente like '%" + Request.QueryString["data"].ToString() + "%' )");
    }

    if (Request.QueryString["transacao"] != null)
    {
        sbSelect.Append(" and San_Chave.Transacao = " + Convert.ToInt32(Request.QueryString["transacao"]));
    }

    #endregion

    dsChave.SelectCommand = sbSelect.ToString();
}

My markup

<%@ Page Title="" Language="C#" MasterPageFile="~/San/masterPage/San.Master" AutoEventWireup="true" CodeBehind="ListaChaves.aspx.cs" Inherits="Ui.San.Chaves.ListaChaves" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">            

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentConteudo" runat="server">

<div class="divLightBox" title="Devolução de Chave" id="DevolucaoBox"></div>

<%--Aqui vem o Topo de Informaçoes da Lista--%>
<div id="InfoLista">
    <div id="InfoListaDados">
        <div id="InfoListaTabela">
            <table width="640" border="0" cellspacing="0" cellpadding="0" 
                style="margin-right: 0px">
              <tr>
                <td width="189" align="left" style="width: 440px">
                    <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td >
                            <input id="InputBusca" type="text" value="Procurar Chaves: Nome responsável ou data" /></td>
                        <td width="75"><img src="../tema/_Internas/imgs/btnBusca.jpg" id="btnBuscar" style="cursor:pointer;"/></td>
                      </tr>
                    </table>
                </td>
                <td width="40" align="right">
                    <table border="0" cellspacing="0" cellpadding="3" style="width: 69px">
                      <tr align="center">
                        <td>
                            <img alt="" class="style4" src="../tema/_Internas/icons/date.png" /></td>
                      </tr>
                      <tr class="FonteLegenda">
                        <td align="center">Marcar Entrega</td>
                      </tr>
                    </table>
                </td>
              </tr>    
              <tr>
                <td width="189" colspan="2" align="left" style="width: 440px">
                    <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td>
                                                Transação: 
                                                    <select id="transacao">
                                                        <option value="0">Venda/Aluguel</option>
                                                        <option value="1">Venda</option>
                                                        <option value="2">Aluguel</option>
                                                    </select>
                                                </td>
                      </tr>
                    </table>
                </td>
              </tr>
            </table>
        </div>
    </div>
</div>
<div>

    <p><strong>Exibindo resultado por</strong></p>
    <p><strong>Responsável ou data</strong>: <%= buscaData(Request.QueryString["data"])%> </p>
    <p><strong>Tipo de Transação</strong>: <%=  buscaTransacao(Request.QueryString["transacao"])%></p>
</div>


<asp:ListView ID="lv_chave" runat="server" DataSourceID="dsChave" 
                        EnableModelValidation="True" DataKeyNames="Chave_Id" >
                        <EmptyDataTemplate>
                            <table id="Table1" runat="server" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        nada encontrado
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
            <GroupTemplate>
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
                        <ItemTemplate>


<table width="680" border="0" cellspacing="0" cellpadding="0" id='boxCliente_<%# Eval("Chave_Id") %>'>
  <tr>
    <td>
    <div class="BoxDeDados <%# Eval("Chave_Id") %>">
        <div id="transacao_Id" style="display:none;"><%# Eval("Transacao")%></div>
        <div id="imovel_Id" style="display:none;"> <%# carregaImovel_Id(Eval("Chave_Id").ToString())%></div>
        <div id="cliente_Id" style="display:none;"> <%# Eval("Cliente_Id")%>  </div>

                <div class="BoxBarraTitulo">&nbsp;&nbsp;Expira em <%# Eval("HorasDevolucao")%> Hs&nbsp;&nbsp;&nbsp;Transação:</b> <%# transacao(Eval("Transacao").ToString()) %></div>
        <table width="676" border="0" cellspacing="0" cellpadding="0" class="TxtInter2">
          <tr>
            <td width="225" height="36" bgcolor="#F4F0EF" >
                &nbsp;<b>Data de retirada:</b><br />
                &nbsp;<%# Dt(Eval("DataHoraPegou").ToString(),"dddd dd/MM/yyyy") %>- <b><%# Dt(Eval("DataHoraPegou").ToString(),"HH:mm") %></b>
            </td>
            <td width="393" bgcolor="#F4F0EF">
                &nbsp;<b>Previsão de devolução:</b><br />
                &nbsp;<%# Dt(Eval("DataHoraDevolverPrevisao").ToString(), "dddd dd/MM/yyyy")%>- <b><%# Dt(Eval("DataHoraDevolverPrevisao").ToString(), "HH:mm")%></b>
            </td>
            <td width="58" bgcolor="#F4F0EF" align="center"><b>Editar<br>Status:</b></td>
          </tr>
          <tr>
            <td height="27">
                &nbsp;<span class="TxtInter3"><b>Responsável: </b><%# Responsavel(Eval("Transacao").ToString(), Eval("NomeResponsavel").ToString(), Eval("NomeUsuarioVenda").ToString())%></span>
            </td>
            <td  align="center">
                <%# carregaChaves(Eval("Chave_Id").ToString())%>
            </td>
            <td align="center" valign="top"><%# Icon(Eval("Chave_Id").ToString())%></td>
          </tr>
        </table>
    </div>
    </td>
  </tr>
</table>
                        </ItemTemplate>
                        <LayoutTemplate>

                            <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                <tr id="Tr1" runat="server" style="">
                                    <th id="Th1" runat="server"></th>
                                </tr>
                                <tr ID="groupPlaceholder" runat="server">
                                </tr>
                            </table>                                    
                        </LayoutTemplate>
                    </asp:ListView>
    <asp:SqlDataSource ID="dsChave" runat="server"></asp:SqlDataSource>
</asp:Content>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:12:40+00:00Added an answer on May 26, 2026 at 1:12 pm

    As inferred from the comments i think you are presented with the cached version of the page by the browser to avoid this in IE9
    Go to

    • Internet Options
    • Click Setting in Browing history
    • Select Every time I visit the webpage option

    Since its displaying the cached version the page_load of your page is not hit.
    Few more tips

    This should work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some data from a database on the fly and
I am grabbing data through a jQuery Ajax call, and displaying it on the
In my javascript method I'm calling a xmlhttprequest to grab some data and display
I'm building a JSF+Facelets web app, one piece of which is a method that
I have a main page from where I am making a call to load
Page_Load Calls more than once (4 times in my case) in FireFox but in
I desperately need some help on this one. I've created a <script> that closely
I was just wondering about the correct way to return a reader from a
I've just started looking at JQuery. I don't have any AJAX in my web
I am trying to write an MVC webpage that has two drop down lists.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.