Click here to Skip to main content
6,295,667 members and growing! (12,850 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate

Gridview with a single ModalPopupExtender/Panel for row editing

By TCartwright

Gridview with a single ModalPopupExtender/Panel for row editing
Javascript, XML, C# 2.0.NET 2.0, Win2K, WinXP, Win2003, ASP.NET, WebForms, Ajax, VS2005, Dev
Posted:22 Feb 2007
Views:104,992
Bookmarked:105 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
33 votes for this article.
Popularity: 6.71 Rating: 4.42 out of 5
1 vote, 3.0%
1

2

3
3 votes, 9.1%
4
29 votes, 87.9%
5
A gridview

Screenshot - persongrid.jpg

The modal

Screenshot - personGridEditWindow.jpg

Introduction

I am not a huge fan of the 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 grids 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 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 how 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 bind 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 pop up 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 work around 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 2k5, 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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

TCartwright


Member

Occupation: Web Developer
Location: United States United States

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 50 (Total in Forum: 50) (Refresh)FirstPrevNext
Generalwant to delete the background shaded region PinmemberAshok Nalam19:21 25 Feb '09  
GeneralWorks Beautifully!!! Pinmembernrps20:03 20 Feb '09  
GeneralPage Refreshes on GridView Button Click Pinmember_Groker10:39 21 Jan '09  
GeneralWhat is SCRUB? Pinmemberdenniswong28816:14 28 Aug '08  
GeneralVery Helpful Pinmemberinetfly12311:44 19 Aug '08  
Newsquestion plz help on grid view problem Pinmembervardhan.menta0:31 2 May '08  
Generalexcellent article Pinmembermancred17:50 19 Nov '07  
QuestionThe answer must be so close... PinmemberAndoTheOptimal6:24 22 Oct '07  
GeneralProblem using the technique with formview Pinmembermhariri4:14 13 Oct '07  
AnswerRe: Problem using the technique with formview PinmemberHenrique Duarte2:02 9 Nov '07  
GeneralMuch Thanks Pinmemberairjasper15:06 20 Sep '07  
QuestionAppreciation and Question Pinmemberdetails@insidespirit.com8:55 17 Aug '07  
Questionsticky panel Pinmemberdsmportal5:13 14 Aug '07  
QuestionQuestion Pinmemberstormcandi10:09 11 Jun '07  
AnswerRe: Question PinmemberTorben713:13 6 Jul '07  
GeneralRe: Question Pinmemberstormcandi6:35 6 Jul '07  
Questiona problem! Pinmembervicqqq17:46 5 Jun '07  
QuestionPaging do not work Pinmemberkcchenkd18:33 29 Apr '07  
AnswerRe: Paging do not work PinmemberBurak Donbay5:54 15 May '07  
GeneralRe: Paging do not work Pinmemberdsmportal5:48 14 Aug '07  
GeneralRe: Paging do not work Pinmemberdetails@insidespirit.com12:48 17 Aug '07  
GeneralGood Idea PinmemberVinay Yeluri18:08 17 Apr '07  
GeneralExcellent PinmemberJohn Maloney4:40 11 Apr '07  
GeneralNice idea, though no validation available. PinmemberGary Noter12:03 9 Apr '07  
GeneralRe: Nice idea, though no validation available. PinmemberTCartwright7:46 11 Apr '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 22 Feb 2007
Editor:
Copyright 2007 by TCartwright
Everything else Copyright © CodeProject, 1999-2009
Web13 | Advertise on the Code Project