Aren't you supposed to be working? :) Kristina
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of C. Woody Butler Sent: Tuesday, December 06, 2005 4:23 PM To: [email protected] Subject: Re: [AspNetMetroArea] Very cool ASP.net 1.1/2.0 Container.dataItem trick! DbDataRow rocks YOu CAN do that in your SQL or directly in the ASPX page rather than calling back into a function in your page codebehind... In the SQL would probably be tons faster. That's just a semi-educated guess tho. Directly in the ASPX page would probably be a smidge faster but suffer from string-concat pain so if there's alot of them you're probably better off with sql concatenation or calling back into a function OR I guess you could do a stringbuilder call within the <%# ASPX code %>. --woody C. Woody Butler [EMAIL PROTECTED] [EMAIL PROTECTED] ---------- Original Message ---------------------------------- From: Charles Carroll <[EMAIL PROTECTED]> Reply-To: [email protected] Date: Tue, 6 Dec 2005 12:41:37 -0800 >If you like this tip I will be sharing more throughout Dec and January on > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > if you want to join.... > >I also will add this to "stupid Databinding Tricks" @ http://shrinkster.com/9nu > >Want to avoid code like this (this is VB.net code I would love to see >the C# code but it is probably almost identical): > >BEFORE: > ><%# >dtbndCityStateZipCombo(Container.DataItem("city"),Container.DataItem("state"),Container.DataItem("zip")) >%> > >Function dtbndStateZipCombo(p1 as string,p2 as string, p3 as string) as string > Return p1 & " " & p2 & "<b>" & p3 & "</b> >End Function > > >and BTW This code gets theres times as long and ugly if nulls may be >in data. And even longer for every field. > >Then do this and access all fields in one step: > >AFTER!!!!!! > > ><%# dtbndCityStateZipCombo(Container.DataItem) %> > >Function dtbndStateZipCombo(p1 as dbDataRecord) as string > return(p1.item("city") & " " & p2 .item("state") & >" <b>" & p1.item("zip") & "</b>") >End Function > > >or do this > >THE BEST AFTER!!!!!! > >Function dtbndStateZipCombo(p1 as dbDataRecord) as string > Dim sbTemp as new stringbuilder > Dim strSpacer as string=" " > with sbTemp > .append(p1.item("city")) > .append(strSpacer) > .append(p1.item("state")) > .append(strSpacer) > .append("<b>" & p1.item("zip") & strSpacer) > end with > return (sbTemp.ToString()) >end function > > > > >Yahoo! Groups Links > > > > > > > > ________________________________________________________________ Sent via the WebMail system at cwoodybutler.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Put more honey in your pocket. (money matters made easy). http://us.click.yahoo.com/F9LvrA/dlQLAA/cosFAA/X1EolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetMetroArea/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
