Click here to Skip to main content
11,496,146 members (778 online)
Click here to Skip to main content

GridView with a single ModalPopupExtender/Panel for row editing

, 22 Feb 2007 CPOL 221.4K 9.7K 147
GridView with a single ModalPopupExtender/Panel for row editing.
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
A gridview

Screenshot - persongrid.jpg

The modal

Screenshot - personGridEditWindow.jpg

Introduction

I am not a huge fan of inline row editing that is provided with most ASP.NET grids. So, recently I went about trying to implement a pop up edit window for editing the values contained within a grid's row. To make it even more interesting, I wanted it use Asynchronous JavaScript callbacks to do this. Since I was already using Ajax.net and the AJAX Toolkit, I went about trying to figure out which control to use, and if any, what they provided would suit me.

Requirements

  1. I wanted to be able to pop up an edit window for editing that disabled the background window (or gave the appearance of being disabled).
  2. I wanted to control the save and edit server-side as I was using custom business objects that were bound to the grids through the ObjectDataSource control.
  3. It needed to be asynchronous. I wanted functionality, but I wanted speed, and ease for the customer as well.

History

The ModalPopup: I first looked at the modal popup extender as it seemed to be exactly what I needed. However, there were a couple issues with how I wanted to use it.

  1. The TargetControlID property is required. So, if I wanted to use it the way it was designed, then I would have to embed a ModalPopup into a ItemTemplate column in the grid with an associated button. This did not appeal to me at all. The same issue occurs for the PopupControlID.
  2. Getting the values into the fields contained in the pop-up panel. Again, I could have embedded the panel into the ItemTemplate column and bound the fields using standard binding. This really did not appeal to me. HTML bloat anyone?

The PopupControl: I quickly abandoned this one, as it had even more issues than the modal popup for what I was trying to do.

Raj Kaimal - Master Details using AJAX and the UpdatePanelPopupExtender: I have to say this one looked awesome, and ran quite well. The only issue I ran into is that it flaked out sometimes when doing custom data binding. The other issue was support. I would have hated to wait on Raj to have to update his code for the next version of AJAX. Considering their track record so far with breaking changes to the design of Ajax.net from the beta's to 1.0, I was not overly enthusiastic about this prospect. Nicely done control though. Would love to see something similar embedded into Ajax.net so the workaround I found would be obsolete.

Frustrated, I was about to give up when I read Dynamically-Created-ModalPopupExtender. Which led me back to the use of the ModalPopupExtender. All of the example code is included in the zip, along with an example showing multiple grids embedded inside an ASP.NET AJAX tab. You will need VS.NET 2005 and version 1.0 of the ASP.NET AJAX framework. The images are courtesy of Michael Hoskins.

Changes:

  • 02/26/2007 - Added an option to use XML as the data source. Will default to XML. Also added an email grid.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

spcghst440@hotmail.com
Web Developer
United States United States
No Biography provided

Comments and Discussions

 
QuestionVB equivlant of this ModalPopupExtender/Panel ?? Anyone? Pin
Chenga888815-Jul-13 7:34
memberChenga888815-Jul-13 7:34 
GeneralMy vote of 5 Pin
MohamedKamalPharm27-Jun-13 13:12
professionalMohamedKamalPharm27-Jun-13 13:12 
GeneralMy vote of 5 Pin
manoj kumar choubey7-Feb-12 22:45
membermanoj kumar choubey7-Feb-12 22:45 
GeneralWork like a charm -- Modifications Pin
nitin_rajwar16-Mar-10 2:53
membernitin_rajwar16-Mar-10 2:53 
GeneralRe: Work like a charm -- Modifications Pin
nitin_rajwar16-Mar-10 23:14
membernitin_rajwar16-Mar-10 23:14 
GeneralIs it Possible to access Multiple Modal popupextender to single panel Pin
ravinandhini28-Jan-10 21:21
memberravinandhini28-Jan-10 21:21 
Generalwant to delete the background shaded region Pin
Ashok Nalam25-Feb-09 19:21
memberAshok Nalam25-Feb-09 19:21 
GeneralWorks Beautifully!!! Pin
nrps20-Feb-09 20:03
membernrps20-Feb-09 20:03 
GeneralPage Refreshes on GridView Button Click Pin
_Groker21-Jan-09 10:39
member_Groker21-Jan-09 10:39 
QuestionWhat is SCRUB? Pin
denniswong28828-Aug-08 16:14
memberdenniswong28828-Aug-08 16:14 
AnswerRe: What is SCRUB? Pin
klyoung28-Jun-13 7:45
memberklyoung28-Jun-13 7:45 
GeneralVery Helpful Pin
inetfly12319-Aug-08 11:44
memberinetfly12319-Aug-08 11:44 
Newsquestion plz help on grid view problem Pin
vardhan.menta2-May-08 0:31
membervardhan.menta2-May-08 0:31 
Generalexcellent article Pin
mancred19-Nov-07 17:50
membermancred19-Nov-07 17:50 
QuestionThe answer must be so close... Pin
AndoTheOptimal22-Oct-07 6:24
memberAndoTheOptimal22-Oct-07 6:24 
GeneralProblem using the technique with formview Pin
mhariri13-Oct-07 4:14
membermhariri13-Oct-07 4:14 
AnswerRe: Problem using the technique with formview Pin
Henrique Duarte9-Nov-07 2:02
memberHenrique Duarte9-Nov-07 2:02 
GeneralMuch Thanks Pin
airjasper20-Sep-07 15:06
memberairjasper20-Sep-07 15:06 
QuestionAppreciation and Question Pin
details@insidespirit.com17-Aug-07 8:55
memberdetails@insidespirit.com17-Aug-07 8:55 
Questionsticky panel Pin
dsmportal14-Aug-07 5:13
memberdsmportal14-Aug-07 5:13 
QuestionQuestion Pin
stormcandi11-Jun-07 10:09
memberstormcandi11-Jun-07 10:09 
AnswerRe: Question Pin
Torben716-Jul-07 3:13
memberTorben716-Jul-07 3:13 
GeneralRe: Question Pin
stormcandi6-Jul-07 6:35
memberstormcandi6-Jul-07 6:35 
Questiona problem! Pin
vicqqq5-Jun-07 17:46
membervicqqq5-Jun-07 17:46 
QuestionPaging do not work Pin
kcchenkd29-Apr-07 18:33
memberkcchenkd29-Apr-07 18:33 
AnswerRe: Paging do not work Pin
Burak Donbay15-May-07 5:54
memberBurak Donbay15-May-07 5:54 
GeneralRe: Paging do not work Pin
dsmportal14-Aug-07 5:48
memberdsmportal14-Aug-07 5:48 
GeneralRe: Paging do not work Pin
details@insidespirit.com17-Aug-07 12:48
memberdetails@insidespirit.com17-Aug-07 12:48 
GeneralGood Idea Pin
Vinay Yeluri17-Apr-07 18:08
memberVinay Yeluri17-Apr-07 18:08 
GeneralExcellent Pin
John Maloney11-Apr-07 4:40
memberJohn Maloney11-Apr-07 4:40 
GeneralNice idea, though no validation available. Pin
Gary Noter9-Apr-07 12:03
memberGary Noter9-Apr-07 12:03 
GeneralRe: Nice idea, though no validation available. Pin
TCartwright11-Apr-07 7:46
memberTCartwright11-Apr-07 7:46 
GeneralRe: Nice idea, though no validation available. Pin
adman6669-Oct-07 19:02
memberadman6669-Oct-07 19:02 
GeneralFirefox issues Pin
TCartwright28-Mar-07 8:57
memberTCartwright28-Mar-07 8:57 
Generalexample does not work any more Pin
LeMoustique14-Mar-07 0:36
memberLeMoustique14-Mar-07 0:36 
AnswerRe: example does not work any more Pin
thomas_rp14-Mar-07 14:20
memberthomas_rp14-Mar-07 14:20 
GeneralRe: example does not work any more Pin
TCartwright28-Mar-07 6:41
memberTCartwright28-Mar-07 6:41 
QuestionFirefox support Pin
ryan867530927-Feb-07 15:53
memberryan867530927-Feb-07 15:53 
AnswerRe: Firefox support Pin
ryan867530927-Feb-07 15:54
memberryan867530927-Feb-07 15:54 
General2.0.0.2 Firefox issues Pin
TCartwright27-Feb-07 12:57
memberTCartwright27-Feb-07 12:57 
GeneralRe: 2.0.0.2 Firefox issues Pin
TCartwright28-Feb-07 6:37
memberTCartwright28-Feb-07 6:37 
GeneralRe: 2.0.0.2 Firefox issues Pin
TCartwright2-Mar-07 6:03
memberTCartwright2-Mar-07 6:03 
GeneralRe: 2.0.0.2 Firefox issues Pin
TCartwright6-Mar-07 6:35
memberTCartwright6-Mar-07 6:35 
GeneralRe: 2.0.0.2 Firefox issues Pin
strazz9-Mar-07 6:46
memberstrazz9-Mar-07 6:46 
GeneralRe: 2.0.0.2 Firefox issues Pin
TCartwright9-Mar-07 8:43
memberTCartwright9-Mar-07 8:43 
GeneralLooks great in IE.. but... Pin
terriblecow27-Feb-07 10:57
memberterriblecow27-Feb-07 10:57 
GeneralRe: Looks great in IE.. but... Pin
terriblecow27-Feb-07 12:03
memberterriblecow27-Feb-07 12:03 
GeneralRe: Looks great in IE.. but... Pin
TCartwright27-Feb-07 12:03
memberTCartwright27-Feb-07 12:03 
GeneralRe: Looks great in IE.. but... Pin
terriblecow27-Feb-07 12:06
memberterriblecow27-Feb-07 12:06 
GeneralRe: Looks great in IE.. but... Pin
TCartwright27-Feb-07 12:34
memberTCartwright27-Feb-07 12:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150520.1 | Last Updated 22 Feb 2007
Article Copyright 2007 by spcghst440@hotmail.com
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid