简体   繁体   中英

Popup with a gridview when a link is clicked

Could someone help me out in getting a popup with a gridview(with 2 columns) inside when a link is clicked. I need some help badly. Can someone please tel me how to start and the procedure. I will be thankful. 2 columns in the gridview include checkbox and Text. This should get populated from database and after modifying that. it should save it in the database!!

I really appreciate all your help!! Thanks!

If you have no time, and you want things to work "magically"; go download Ajax Control Toolkit ;

  1. Drop a link in your markup that would open the grid; name it MyLink
  2. Define the two column'ed GridView inside a Panel .

<asp:Panel runat="server" ID="pnlGrid"><asp:GridView ...></asp:Panel>

  1. Drop ModalPopupExtender control from Ajax Control Toolkit in your markup.
  2. Add Panel's id in ModalPopupExtender 's markup

<act:ModalPopupExtender ID="MyModalPopupExtender1" runat="server" TargetControlID="MyLink" PopupControlID="pnlGrid" style="display:none" OkControlID="MyOkButton"/>

Now clicking on the MyLink would open the Popup with GridView inside; dont forget to add GridView.EmptyDataText property, so that you'd know when there are no records to show.

Last, but not least, upon your page load, load the data from your database, and assign it your GridView.DataSource

This article is a good start. Enjoy!

Assuming you are using asp.net webforms, the easiest way to do this is to use the Microsoft Ajax Toolkit . With it you can create your panel control with the gridview and extend it with the modal popup extender. You will then hook up the link's click event to show the modal popup control (and any other databinding you need to do).

Thus when you click on the link, the panel will be displayed with the gridview.

If you are using Web Forms, an option would be to use the Ajax Control Toolkit's ModalPopup control. This control is very easy to add to a web forms page. It will allow you to extend the link with the modal and load the gridview in a panel that the modal popup will then display.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM