If I understand you correctly, you don't need a popup, you just trying to activate some div on your page. You will need to make this div server side

<div class="popup" runat="server" style="display:none" id="divPop">
 <asp:TextBox ID="_lname" runat="server"></asp:TextBox>

    <asp:Button ID="Button1" 
        runat="server" 
        Text="save" OnClick="Button1_Click" 
         />
</div>

and then in your server side click

protected void btnOpenPopupWindow_Click(object sender, EventArgs e)
{
  divPop.Attributes.Add("style", "display:block);
}

this will make your div visible

EDIT better solution in your case would be using asp panel instead of div.

<asp:panel id="divPop" visible="false" runat="server">
    <asp:TextBox ID="_lname" runat="server"></asp:TextBox>

      <asp:Button ID="Button1" 
    runat="server" 
    Text="save" OnClick="Button1_Click" 
     />
</asp:panel>

and then you will be able to manipulate visibility in your server side code very easy

protected void btnOpenPopupWindow_Click(object sender, EventArgs e)
{
  divPop.Visible=true;
}
Answer from Yuri on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › aspnet › web-forms › overview › ajax-control-toolkit › modalpopup › launching-a-modal-popup-window-from-server-code-cs
Launching a Modal Popup Window from Server Code (C#) | Microsoft Learn
Set properties for the button which loads the control, the button which makes it disappear, and the ID of the actual popup. <ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlId="ClientButton" PopupControlID="ModalPanel" OkControlID="OKButton" /> As with all web pages based on ASP.NET AJAX; the Script Manager is required to load the necessary JavaScript libraries for the different target browsers: ... Run the example in the browser. When you click on the button, the modal popup appears.
Top answer
1 of 3
2

If I understand you correctly, you don't need a popup, you just trying to activate some div on your page. You will need to make this div server side

<div class="popup" runat="server" style="display:none" id="divPop">
 <asp:TextBox ID="_lname" runat="server"></asp:TextBox>

    <asp:Button ID="Button1" 
        runat="server" 
        Text="save" OnClick="Button1_Click" 
         />
</div>

and then in your server side click

protected void btnOpenPopupWindow_Click(object sender, EventArgs e)
{
  divPop.Attributes.Add("style", "display:block);
}

this will make your div visible

EDIT better solution in your case would be using asp panel instead of div.

<asp:panel id="divPop" visible="false" runat="server">
    <asp:TextBox ID="_lname" runat="server"></asp:TextBox>

      <asp:Button ID="Button1" 
    runat="server" 
    Text="save" OnClick="Button1_Click" 
     />
</asp:panel>

and then you will be able to manipulate visibility in your server side code very easy

protected void btnOpenPopupWindow_Click(object sender, EventArgs e)
{
  divPop.Visible=true;
}
2 of 3
0

you are using server side control in your code.

<asp:Button ID="btnOpenPopupWindow" 
        runat="server" 
        Text="Open Popup Window" OnClick="btnOpenPopupWindow_Click" 
         />

click of this button will trigger immediate post to the server and server (your ASP.NET application) will handle the event. The only way you will be able to open a popup from the server if you will register script to do this. Your CLick should look something like

 protected void btnOpenPopupWindow_Click(object sender, EventArgs e)
{
  ClientScript.RegisterStartupScript(this.GetType(), 
    "yourWindowName", 
     String.Format("<script>window.open('{0}');</script>", yourURL));
}
🌐
C# Corner
c-sharpcorner.com › forums › open-popup-window-in-button-click-event-without-using-jquery
open popup window in button click event without using jquery
<asp:Button ID="btnOpenPopupWindow"runat="server"Text="Open Popup Window" OnClick="btnOpenPopupWindow_Click"/>
🌐
Aspdotnet-suresh
aspdotnet-suresh.com › 2014 › 05 › jquery-display-popup-window-on-button-click-in-asp-net.html
jQuery - How to Display Popup Window on Button Click in Asp.net
aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies ... Here I will explain how to display popup window on button click in asp.net using jQuery ui modal popup window or open jQuery modal popup window on button click in asp.net.
🌐
ASPSnippets
aspsnippets.com › questions › 146384 › Open-Modal-Popup-on-Button-click-with-different-Title-and-Body-using-C-and-VBNet-in-ASPNet
Open Modal Popup on Button click with different Title and Body using C and VBNet in ASPNet
August 5, 2019 - Protected Sub Show(ByVal sender As Object, ByVal e As EventArgs) showPopup("Greetings", "Welcome to ASPSnippets.com") End Sub Private Sub showPopup(ByVal title As String, ByVal body As String) ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" & title & "', '" & body & "');", True) End Sub Protected Sub Display(ByVal sender As Object, ByVal e As EventArgs) showPopup("Hey", "Guys !") End Sub · Screenshot · I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html ·
🌐
Devcurry
devcurry.com › 2009 › 01 › open-popup-window-on-aspnet-button.html
Open a PopUp Window on the ASP.NET Button Click event and pass Parameters
protected void Button1_Click(object sender, EventArgs e) ... Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls.
🌐
YouTube
youtube.com › rashicode
How to open popup model on button click in asp net. - YouTube
Hello friend's this is Rashid Hussain come with another video In this tutorial, you will learn how to open a popup model on button click using bootstrap mod...
Published   September 30, 2022
Views   3K
Find elsewhere
🌐
YouTube
youtube.com › rashicode
ASP.NET : How to Open Popup Modal on Button Click In Asp.net web forms for Crud Operation (part 1) - YouTube
Hello friend's this is Rashid Hussain come with another video In this tutorial, you will Learn how to create a popup modal window in ASP.NET web form using C...
Published   March 5, 2023
Views   26K
🌐
DaniWeb
daniweb.com › programming › web-development › threads › 70169 › popup-window-on-button-click
asp.net - Popup window on button click | DaniWeb
Since you are capturing user action via popup, you will most likely use client side scripting to get the user input. Once you get the user input, you can set it to some control in your form which will get sent to your server when the form is submitted. ... <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="HiddenField1.value = prompt('Enter your feedback','');" /> <asp:HiddenField ID="HiddenField1" runat="server" /> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> </form>
🌐
Ittutorials
ittutorials.in › articles › open-popup-window-on-button-click-event.aspx
ASP.Net - Open popup window on button click event (C# & VB.Net)
+ "window.open('popup.aspx?data=" + HttpUtility.UrlEncode(intId.ToString()) + "','new window', 'top=90, left=200, width=300, height=100, dependant=no, location=0, alwaysRaised=no, menubar=no, resizeable=no, scrollbars=n, toolbar=no, status=no, center=yes')" + "</script>"; ScriptManager.RegisterStartupScript((Page) HttpContext.Current.Handler, typeof(Page), "Script1", strPopup, false); } Protected Sub btnOpenPopupWindow_Click(sender As Object, e As System.EventArgs) Handles btnOpenPopupWindow.Click Dim intId As Integer = 100 ' Passing intId to popup window.
🌐
Aspnetawesome
demo.aspnetawesome.com › PopupDemo
Popup | ASP.net Core Awesome
@(Html.Awe().InitPopup(new PopupOpt { Name = "popupdd1", Url = Url.Action("DropdownContent"), LoadOnce = true, Dropdown = true })) @Html.Awe().Button().Text("open popup").OnClick(Html.Awe().OpenPopup("popupdd1")) <button type="button" class="awe-btn" onclick="awe.open('popupdd1', {}, event)">open the same popup</button> <script> function dropdownFromHeader(){ awe.open({ init: function ({cont}) { var list = '<ul style="height:calc(100vh - 150px);">'; for (let i = 0; i < 100; i++) { list += '<li> item ' + i + '</li>'; } list += '</ul>'; cont.append(list); }, dropdown: true, opener: $('#header'),
🌐
C# Corner
c-sharpcorner.com › UploadFile › cd7c2e › open-a-new-web-form-in-the-model-popup-of-Asp-Net-applicatio
Open a New Web Form in the Modal Popup of ASP.Net Application
May 27, 2024 - Step 4. Here I used a Panel as a Popup and two buttons for opening and closing the application. Under the Panel, you need to add the IFrame that will be used to open the Web Form in the Panel. <asp:Panel ID="Panl1" runat="server" CssClass="Popup" align="center" style="display:none"> <iframe style="width: 350px; height: 300px;" id="irm1" src="WebForm2.aspx" runat="server"></iframe> <br/> <asp:Button ID="Button2" runat="server" Text="Close" /> </asp:Panel>