473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

conditional items in a datalist

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
Nov 18 '05 #1
2 1380
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" <in**@hyper-typer.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #2
Joe
Thanks Chirs - much obliged.

Joe

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
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" <in**@hyper-typer.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
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


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: tshad | last post by:
I have a DataList that I have set up to allow editing. The edit button does go to the subroutine defined by OnEditCommand. The problem is that it doesn't change the fields to editing fields. The...
2
by: alan | last post by:
Hi All, I have a DataList, how can I retrieve all the items in the datalist? eg. for (int i=0; i < DataList.Item.Count; i++) MyArray = DataList.Item.xxxxx.?? Thanks a lot!
0
by: Charlie | last post by:
Hi: I have a DataList that uses an HTML table to format items in its bound datasource. No server side control templates are used. When form posts back from a button click (separate from...
1
by: Ed Chiu | last post by:
Hi, I have the following item template in a datalist: <asp:LinkButton id="lnkAction" runat="server" CommandName="Action" cssClass="TabMenu"> <%# Container.DataItem("Title") %>...
1
by: Chris Kettenbach | last post by:
Good Afternoon all, I have a datalist. When I switch in to edit mode, I need to hide a couple controls on the "ItemTemplate" and of course, when exiting Edit Mode, I will need to show these items...
3
by: Danny Tuppeny | last post by:
Hi all, I've got a DataList that's bound to a datasource with two columns (well, two that matter). One is called GigDate, and one is called RescheduledFromDate. GigDate doesn't allow NULLs,...
0
by: TMT32 | last post by:
Hi, Thanks yor help first. Now I can access my multiview control in datalist. But how to get runtime "Datalist Item index" value ??? Because I want to change the multiview default view page in per...
6
by: Henrik Goldman | last post by:
Hello, I have a dataset which consist of a string username and string hostname as a key and then an integer representing a count as the matching "second" value in a pair. So far I've used...
1
by: obs | last post by:
Hi. I'm using the following code to change a hyperlink attributes of a hyperlink which is located in an itemtemplate of a datalist. When I debug it the attributes are changed and everything is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.