conditional items in a datalist

J

Joe

Hey folks,

Back for more help.

I have a datalist that I want to output formatted addresses to so I want
something like:

___________________________________________
Joe Bloggs,
Address Line 1,
Address Line 2,
Address Line 3.
City,
County,
Country.
___________________________________________
Jane Bloggs,
Address Line 1,
Address Line 2,
Address Line 3.
City,
County,
Country.
___________________________________________


Each of these values is coming from seperate fields in mhy database.

I can output such an address in a row of my datalist no problem except if
one of the fields is null.

Say for example Address Line 3 was null, I wouldn't want to output the
accompanying line break or comma.

I know how to format conditionally using the on itemcreate event. How would
I go about writing my onIttemcreate event to catch that scenario and make
the adjustments to the output?

Joe
 
C

Chris Jackson

if (0 == addressLine2.Text.Length) {
addressLine2.visible = false;
addressLine2LineBreakLiteranControl.Visible = false;
}
 
J

Joe

Thanks Chirs - much obliged.

Joe

Chris Jackson said:
if (0 == addressLine2.Text.Length) {
addressLine2.visible = false;
addressLine2LineBreakLiteranControl.Visible = false;
}

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top