Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
Opening a popup by calling Javascript from CodeBehind

I am trying to open a popup window by calling a JavaScript function in CodeBehind (vb.net) on a button click event.

The idea is that I click the button, the button click event does a bunch of stuff, then fires the javascript function to open the popup window.

Javascript:

function openSync() {
            var companyId = $("#<%= txtCompanyID.ClientID%>").val();
            $find("<%= RadWindowManager1.ClientID%>").open("SyncDatabases.aspx?CompanyID=" + encodeURIComponent(companyId), "winSyncProcess");
        }

I can call the openSync function in CodeBehind using:

 ScriptManager.RegisterStartupScript(Me, Me.GetType(), "open", "openSync();", True)

When attempting this, I am getting a TypeError: Cannot read properties of null (reading 'open') error.

BUT, if I assign the OnClientClick property on the button itself to

OnClientClick="openSync(); return false;"

the Javascript works fine, and the popup window appears as it should, but doing so ignores the CodeBehind button click event and doesn't do the things it's suppose to do.

I am using a RadWindowManger:

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
        <Windows>
            <ic:PopupWindow ID="winSyncProcess" runat="server" Width="800px" Height="600px" OnClientClose="OnSyncProcessClose"></ic:PopupWindow>
        </Windows>
    </telerik:RadWindowManager>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ended up using ScriptManager.RegisterStartupScript(Me, Me.GetType(), "setTimeout(function () { openSync(); }, 100);", openSync, True) and that solved the issue.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda