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 Sponsor --------------------~-->
Help tsunami villages rebuild at GlobalGiving. The real work starts now.
http://us.click.yahoo.com/T42rFC/KbOLAA/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/