conditional items in a datalist

  • Thread starter Thread starter Joe
  • Start date Start date
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
 
if (0 == addressLine2.Text.Length) {
addressLine2.visible = false;
addressLine2LineBreakLiteranControl.Visible = false;
}
 
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
 
Back
Top