Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About Popup Window in ASP.Net

I have a gridview which contains a details button as the last column.

My aspx:

<asp:GridView Width="100%" ID="gv_NotApplied" CssClass="datatable" AllowSorting="True"
    runat="server" TabIndex="2" AutoGenerateColumns="False" AllowPaging="True" GridLines="None">
    <Columns>
        <asp:TemplateField HeaderText="serial">
            <ItemTemplate>
                <asp:Label ID="lblSerial" runat="server"></asp:Label>

            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField HeaderText="name" DataField="crs_name" />
        <asp:BoundField HeaderText="lecturer" DataField="name" />
        <asp:TemplateField HeaderText="details">
            <ItemTemplate>
                <asp:ImageButton ID="Ibtn_Details" runat="server" ImageUrl="~/Images/detail.png"
                    CommandArgument='<%#((GridViewRow)Container).RowIndex%>' CommandName="Detail"
                    CausesValidation="false" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <RowStyle VerticalAlign="Top" CssClass="row" />
</asp:GridView>

What I would like to do is:

  • When the user clicks the details button, open a pop up window (dialog window).

  • In this window I would like to put some asp.net server controls in (like grid views). So I want this window to enable/allow me to access those controls in the code behind.

like image 279
Anyname Donotcare Avatar asked Aug 09 '11 12:08

Anyname Donotcare


People also ask

What is a pop up window?

A small window that is displayed on top of the existing windows on screen. A popup window can be used in any application to display new information; however, the term often refers to an advertisement (see popup ad).

How can use popup window in asp net c#?

Step 1 : Start a new ASP.NET MVC Web application. Add a new controller called Home and in the Home controller, the Index method is available to you but there is not a view with it so add a view by right-clicking in Index action. Step 2 : In index. aspx add one HTML button to open our modal popup window like below.

What is modal popup in asp net?

Modal popup is a child window on the main window, that disables the main window functionality until the selection of a button in the child window. In a sample image given below, I have shown the modal popup window. Types of Modal Popups that can be created in ASP.NET.

What is pop up model?

Introduction. Popups are a commonly used rich interaction. By using a popup you can open a new layer above the current main page. If the popup is set as “Modal”, it also prevents any interaction with the rest of the web application.


2 Answers

I suggest that you open a modal pop up window like colorbox and this color box can point to show an aspx page that contain all the controls that you want. The color box will tell you how to make your button open the modal window and how to put in it the page.

like image 145
Samir Adel Avatar answered Nov 15 '22 08:11

Samir Adel


For this kind of thing I love the following construct:

<asp:UpdatePanel id="UpdatePanel1" runat="server">
  <ContentTemplate>
    <asp:Panel id="popup" visible="false" runat="server">
      popup Content
    </asp:Panel>

    <asp:AlwaysVisibleControlExtender ID="AlwaysVisibleControlExtender1" TargetControlID="popup" runat="server" />
    <asp:DragPanelExtender ID="DragPanelExtender1" TargetControlID="popup" runat="server" />
  </ContentTemplate>
 </asp:UpdatePanel>
  • Like this you can set popup.visible = true; when you need the popup and have full control over its contents.
  • The Updatepanel + Ajax Control Toolkit Extender will give it the look and feel of an independant popup, though.
like image 44
Steav Avatar answered Nov 15 '22 09:11

Steav