conditional items in a datalist

Discussion in 'ASP .Net' started by Joe, Dec 9, 2003.

  1. Joe

    Joe Guest

    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
    Joe, Dec 9, 2003
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    >
    Chris Jackson, Dec 9, 2003
    #2
    1. Advertising

  3. Joe

    Joe Guest

    Thanks Chirs - much obliged.

    Joe

    "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
    Joe, Dec 9, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry Camel

    Conditional Colors in a DataList Control

    Jerry Camel, Feb 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    307
    =?Utf-8?B?U3VyZXNo?=
    Feb 12, 2004
  2. Nevyn Twyll
    Replies:
    8
    Views:
    1,848
  3. =?Utf-8?B?RWQgQ2hpdQ==?=

    Conditional item template for a datalist

    =?Utf-8?B?RWQgQ2hpdQ==?=, Jul 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,005
    Craig Deelsnyder
    Jul 27, 2005
  4. Danny Tuppeny

    Conditional label within DataList?

    Danny Tuppeny, Oct 29, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    674
    Danny Tuppeny
    Oct 30, 2005
  5. Alec S.
    Replies:
    10
    Views:
    10,091
    Alec S.
    Apr 16, 2005
Loading...

Share This Page