25. September 2008 03:47
This may be old news for some of you out there but for those of you who are just starting to use the AjaxControlToolkit I wanted to show how you can nest the ModalPopup inside a GridView. This technique has worked for the most part. However, I will caution if you show a lot of records within the gridview it could slow up performance on rendering the page. Keep in mind this technique below is adding the ModalPopup to each row within the gridview.
First you need the following style within the page your CSS sheet
Second you will notice we have the AjaxControlToolkit registered on the aspx page, along with a ScriptManager
Third, you will see the GridView with one TemplateField that has a LinkButton, Panel, Button and the ModalPopupExtender.
The LinkButton is set as the TargetControlID
The Panel is set as the PopupControlID
The Button is set as the OkControlID
This is pretty much all you need to utilize the ModalPopup nested within a GridView.
Note: I handled the GridView binding in the code behind, or you can handle it with a SqlDataSource.
Hope this has helped on how you can utilize the ModalPopup inside a gridview.