Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > conditional items in a datalist

Reply
Thread Tools

conditional items in a datalist

 
 
Joe
Guest
Posts: n/a
 
      12-09-2003
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


 
Reply With Quote
 
 
 
 
Chris Jackson
Guest
Posts: n/a
 
      12-09-2003
if (0 == addressLine2.Text.Length) {
addressLine2.visible = false;
addressLine2LineBreakLiteranControl.Visible = false;
}

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      12-09-2003
Thanks Chirs - much obliged.

Joe

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:(E-Mail Removed)...
> if (0 == addressLine2.Text.Length) {
> addressLine2.visible = false;
> addressLine2LineBreakLiteranControl.Visible = false;
> }
>
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows Client
> Windows XP Associate Expert
> --
> More people read the newsgroups than read my email.
> Reply to the newsgroup for a faster response.
> (Control-G using Outlook Express)
> --
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional label within DataList? Danny Tuppeny ASP .Net 3 10-30-2005 09:04 AM
Conditional item template for a datalist =?Utf-8?B?RWQgQ2hpdQ==?= ASP .Net 1 07-27-2005 06:15 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Conditional Colors in a DataList Control Jerry Camel ASP .Net 2 02-12-2004 08:36 PM



Advertisments