We're A Community of 1058K IT Pros Here For Help, Advice, Solutions, Professional Growth and Fun. Join Us!
We're A Community of 1058K IT Pros Here For Help, Advice, Solutions, Professional Growth and Fun. Join Us!
We're a community of 1058K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,057,146 Mem bers Technology Publication meets Social M edia
JOIN DANIWEB
MEMBER LOGIN
Software Development
Web Development
Internet Marketing
Business Exchange
Community Center
Web Development > ASP.NET > ASP.NET 2.0, Parent/Child Data Control? Start New Discussion Reply to this Discussion
tgreer
Made Her Cry
7 Years Ago
Team Colleague
2,118 posts since Dec 2004
6
Replies
2 Months
Discussion Span
6 Years Ago
Last Updated
8
Views
tgreer
Made Her Cry
7 Years Ago Experiments continue... It's simple enough to create a SqlDataSource which selects all of the "master" records, and to bind that to a GridView. If one sets the "Enable Selection" to True, it adds a select command control to each row. Then, add a second SqlDataSource, tied to a query or stored procedure that displays the detail. In the wizard, one can specify that a parameter comes from a control, in this case, our first GridView. Create a second GridView, bound to the second SqlDataSource. Now, when the user clicks "Select" in the parent GridView, the child GridView displays all the associated detail records. All well and good. The issue is formatting. I don't want two separate GridViews. I want the second, child or "detail" GridView to display
Team Colleague
2,118 posts since Dec 2004
underneath the parent row. Each "detail" listing should be collapsible... it should be possible to display as many "detail" sections as the user wants. Any suggestions on how to go about that?
tgreer
Made Her Cry
7 Years Ago So many of the C#/ASP.NET threads I start end up with me just talking to myself. Hopefully, everyone is following along diligently, just waiting for a chance to jump in. THIS IS YOUR CHANCE!
Team Colleague
2,118 posts since Dec 2004
www.daniweb.com/web-development/aspnet/threads/39591/asp.net-2.0-parentchild-data-control
1/5
2/28/13
www.daniweb.com/web-development/aspnet/threads/39591/asp.net-2.0-parentchild-data-control
2/5
2/28/13
1 uigSse; . sn ytm 2 uigSse.aa . sn ytmDt;
3 uigSse.aaSllet . sn ytmDt.qCin; 4 uigSse.ofgrto; . sn ytmCniuain 5 uigSse.olcin; . sn ytmCletos 6 uigSse.e; . sn ytmWb 7 uigSse.e.euiy . sn ytmWbScrt; 8 uigSse.e.I . sn ytmWbU; 9 uigSse.e.IWbotos . sn ytmWbU.eCnrl; 1. uigSse.e.IWbotosWbat; 0 sn ytmWbU.eCnrl.ePrs 1. uigSse.e.IHmCnrl; 1 sn ytmWbU.tlotos 1. 2 1. pbi prilcasso_s :Sse.e.IPg 3 ulc ata ls hwtr ytmWbU.ae 1. { 4 1. 5 1. 6 1. 7 1. 8 1. 9 2. 0 2. 1 2. 2 2. 3 2. 4 2. 5 2. 6 2. 7 2. 8 2. 9 3. 0 3. 1 3. 2 3. 3 3. 4 3. 5 3. 6 3. 7 3. 8 3. 9 4. 0 4. 1 4. 2 4. 3 4. 4 4. 5 4. 6 4. 7 4. 8 4. 9 5. 0 5. 1 5. 2
Recently Updated Articles
pbi Sloncincn; ulc qCneto on pbi Slomn cd ulc qCmad m; pbi Slaaedrd; ulc qDtRae r poetdvi Pg_odojc sne,Eetrse rtce od aeLa(bet edr vnAg ) { SsinAd"uhpr" 1; eso.d(at_es, ) cn =nw on e SloncinCniuainaae.oncintig[HLDSCnetoSrn".oncintig; qCneto(ofgrtoMngrCnetoSrns"EPEKoncintig]CnetoSrn) cn.pn) onOe(; cd=nwSlomn(sSlcIseyes,cn) m e qCmad"peetsuBPr" on; cdCmadye=CmadyeSoePoeue m.omnTp omnTp.trdrcdr; cdPrmtr.d(@es,SlbyeIt; m.aaeesAd"pr" qDTp.n) cdPrmtr[@es]Vle=Ssin"uhpr"; m.aaees"pr".au eso[at_es] d =cdEeueedr) r m.xctRae(; rtIseDtSuc =d; prsu.aaore r rtIseDtBn(; prsu.aaid) d.ls(; rCoe) } poetdvi rtIseIeCmadOjc Sne,RpaeCmadvnAg e rtce od prsu_tmomn(bet edr eetromnEetrs ) { i (.tmIeTp = LsIeTp.tm| eIe.tmye= f eIe.tmye = ittmyeIe | .tmIeTp = LsIeTp.lentnIe) ittmyeAtraigtm { cdPrmtr.la(; m.aaeesCer) cd=nwSlomn(sSlcHsoyysu" cn) m e qCmad"peetitrBIse, on; cdCmadye=CmadyeSoePoeue m.omnTp omnTp.trdrcdr; cdPrmtr.d(isei" SlbyeIt; m.aaeesAd"su_d, qDTp.n) cdPrmtr[isei".au =Sse.ovr.on3(.omnAgmn) m.aaees"su_d]Vle ytmCnetTIt2eCmadruet; RwepaemRw=nwRwepae) oTmlt yo e oTmlt(; Rpae rtDtis=nwRpae(; eetr preal e eetr) d =cdEeueedr) r m.xctRae(; rtDtisDtSuc =d; preal.aaore r rtDtisIeTmlt =mRw preal.tmepae yo; rtDtisDtBn(; preal.aaid) d.ls(; rCoe) Paeodrp =(lcHle).tmFnCnrl"heal) lcHle h PaeodreIe.idoto(pDti"; p.otosAdrtDtis; hCnrl.d(preal)
5. 3 5. 4 5. 5 5. 6 5. 7 5. 8 5. 9 6. 0 6. 1 6. 2 6. 3
} } pbi casRwepae:Iepae ulc ls oTmlt Tmlt { pbi vi IsataenCnrlcnanr ulc od ntnitI(oto otie) { Ltrloto dtiRw=nwLtrloto(; ieaCnrl ealo e ieaCnrl) dtiRwDtBnig+ nwEetade(ealo_aaidn) ealo.aaidn = e vnHnlrdtiRwDtBnig;
www.daniweb.com/web-development/aspnet/threads/39591/asp.net-2.0-parentchild-data-control
3/5
2/28/13
6. 4 6. 5 6. 6 6. 7 6. 8 6. 9 7. 0 7. 1 "/d"+ <t> 7. 2 7. 3 7. 4 <t>; /r" 7. 5 7. 6 7. } 7 } } }
pbi vi dtiRwDtBnigojc sne,Eetrse ulc od ealo_aaidn(bet edr vnAg ) { Ltrloto dtiRw=(ieaCnrlsne; ieaCnrl ealo Ltrloto)edr RpaeIe cnanr=(eetrtmdtiRwNmnCnanr eetrtm otie RpaeIe)ealo.aigotie; dtiRwTx ="t>t> +DtBne.vlcnanr "aatmato" + ealo.et <r<d" aaidrEa(otie, DtIe.cin) "t> +DtBne.vlcnanr "aatmtmsap)+"/d"+ <d" aaidrEa(otie, DtIe.ietm" <t> "t> +DtBne.vlcnanr "aatmnm" +"/d"+ <d" aaidrEa(otie, DtIe.ae) <t> "t> +DtBne.vlcnanr "aatmdti" +"/d <d" aaidrEa(otie, DtIe.eal) <t>
BTW, if you've ever wondered how to dynamically create a Repeater complete with an ItemTemplate and DataBinding, programmatically, the above code in orange demonstrates this very nicely! You're welcome. Now, once I get this issue resolved, the next step is to implement the detail rows as ClientCallbacks, so that as new records are added to the details table, they'll "magically appear" in the page.
tgreer
Made Her Cry
7 Years Ago
Team Colleague
2,118 posts since Dec 2004
Figured it out. I'll write this up, eventually. The answer is to create a public class with two properties, the id of the record needed for the query to the details, and the UniqueID of the Placeholder for a pariticular row/item in the parent. Store these objects in a List<> generic, marked as Serializable. Store the List object in ViewState. Then, loop through the List, building the Repeater dynamically for each item in the List.
f1 fan
Posting Whiz in Training 279 posts since Jan 2006
7 Years Ago
Not had time to look over the code yet sorry. Couldnt you put a repeater in a user control and then you would be able to expand every one? I cheat. I bought the Infragistics controls years ago as they save me so much time. They have had hierarachical grids for a few years in both win forms and asp.net. I know its good to make your own, but why reinvent the wheel when there are other things that need doing :D But if you do have the time then maybe worth thinking about writing the control from scratch based on the repeater rather than a user control?
Craig Pelkie
New bie Poster 1 post since Mar 2006
6 Years Ago Would the System.Web.UI.WebControls.DetailsView provide the detail display capabilities that you're after? In .NET 1.1 I coded an HTML table with embedded text boxes, the DetailsView provides similar functionality with the benefit of being a single control.
BoggyBoy
New bie Poster 1 post since Apr 2006
6 Years Ago
Would the System.Web.UI.WebControls.DetailsView provide the detail display capabilities that you're after? In .NET 1.1 I coded an HTML table with embedded text boxes, the DetailsView provides similar functionality with the benefit of being a single control.
http://www.asp.net/QuickStart/util/srcview.aspx?path=~/aspnet/samples/data/GridViewMasterDetails.src
Ads by Google
1000
www.daniweb.com/web-development/aspnet/threads/39591/asp.net-2.0-parentchild-data-control 4/5
2/28/13
You
This article has been dead for over three months: Start a new discussion instead
Post: Bold Italic Cd oe Iln Cd nie oe Link Quote Heading Sub-Heading # List List
Undo
0
Tw eet
0
Like Share
asp.net
bind blob
c#
calendar checkbox checkboxlist columns company connect connection control create css data database datalist dataset datetime
developement display dropdown dropdownlist exists field file firefox formview from get google gridview healthmonitor hierarchical hospital html i image images in java jquery jsp list login mail monitor mysql navigationmenu net no oracle out page paypal place plugin problem proxy radiobutton refresh response sandbox second selectedvalue server service session share sharepoint sql sqlserver2008 store table textbox to toolkit total translate update upload user value vb vb.net view vs web webcam webform webservice xml 2008 2010
Home
About Us
Contact Us
Consulting
Press Kit
Advertising
RSS Feed
TOS
Donate
API
Typing
Rules
www.daniweb.com/web-development/aspnet/threads/39591/asp.net-2.0-parentchild-data-control
5/5