Modal Global Asp.net Webforms

Asked

Viewed 161 times

0

I created a modal, which I will practically use in all forms of the system, but I do not know how to call this modal in the forms. This is the code of my modal, the page calls Modal.aspx, and the modal is the #modalexclusao

<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Modal.aspx.cs" Inherits="web_academia.Modal" %>
  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>jQuery UI Dialog - Default functionality</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <script>
      $(function() {
        $("#modalexclusao").dialog();
      });
    </script>
  </asp:Content>
  <asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="server">
    <div id="modalexclusao" title="Senha Exclusão">
      <p>Senha Exclusão teste form</p>
    </div>
  </asp:Content>

How can I call it in another page’s code-Behind ?

I tried this way:

$(document).ready(function() {
  $('#modalexclusao').modal({
    url: 'Modal.aspx'
  });
});

But the modal does not appear.

  • Have you ever tried using @Renderpage("~/Views/Shared/Sampleview.cshtml") ? You just have to see how to play this on a conditional... But that’s the job of this guy...

  • I use webforms @Diegosantos, updated the way I tried to do, but it doesn’t work properly.

  • Puts, I’m sorry missed attention. Let’s research

  • 1

    All right @Diegosantos, I’m searching to see if I can find a solution.

1 answer

0


I hadn’t thought about the possibility, just put the modal on the Master page, and it worked, I can call it on any page of the project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.