473,406 Members | 2,619 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,406 software developers and data experts.

item in dataset

Hi, how can i check one spesific item in a dataset and then hide that item
if there isnt any data in it? in a gridview i can use e.row.cells(1).text to
read the value, but how can i read one item in a dataset?

/Per W.
Nov 15 '06 #1
4 1405
What is the item? Does the dataset have many tables or just one? Can you
provide more specifics?

"Per W." <pe**@tiscali.nowrote in message
news:ej**********@troll.powertech.no...
Hi, how can i check one spesific item in a dataset and then hide that item
if there isnt any data in it? in a gridview i can use e.row.cells(1).text
to read the value, but how can i read one item in a dataset?

/Per W.

Nov 15 '06 #2

"Jeff Allan" <bo******@community.nospamskrev i melding
news:eO**************@TK2MSFTNGP02.phx.gbl...
What is the item? Does the dataset have many tables or just one? Can you
provide more specifics?
Sorry, its datalist, not dataset and one table. if i use the gridview then i
can use the rowdatabound and e.row.cells(number).text to read the context of
the cell. But i want to use datalist and read the context of a item in that
datalist.

/Per W.
Nov 15 '06 #3
There are a few ways to read data. Did you want to read it at Data Bind
time? If so, you can use the ItemDataBound event to evaluate the data.
Then from there you can hide or show the list item. Or you can loop through
the list and decide.

To Loop:
Dim myItem as DataListItem
For Each myItem in Datalist1.Items
'Add code here to validate and take action.
Loop

DataBind: (From MSDN Library Help)
Private Sub DataList1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) _
Handles DataList1.ItemDataBound
Dim dob As DateTime
Dim doblabel As Label
doblabel = CType(e.Item.FindControl("Label1"), Label)
dob = CType(doblabel.Text, DateTime)
If dob.Month = Today.Month Then
e.Item.BackColor = Color.Yellow
End If
End Sub

"Per W." <pe**@tiscali.nowrote in message
news:ej**********@troll.powertech.no...
>
"Jeff Allan" <bo******@community.nospamskrev i melding
news:eO**************@TK2MSFTNGP02.phx.gbl...
>What is the item? Does the dataset have many tables or just one? Can
you provide more specifics?

Sorry, its datalist, not dataset and one table. if i use the gridview then
i can use the rowdatabound and e.row.cells(number).text to read the
context of the cell. But i want to use datalist and read the context of a
item in that datalist.

/Per W.

Nov 15 '06 #4

"Jeff Allan" <bo******@community.nospamskrev i melding
news:eD**************@TK2MSFTNGP03.phx.gbl...
There are a few ways to read data. Did you want to read it at Data Bind
time? If so, you can use the ItemDataBound event to evaluate the data.
Then from there you can hide or show the list item. Or you can loop
through the list and decide.

To Loop:
Dim myItem as DataListItem
For Each myItem in Datalist1.Items
'Add code here to validate and take action.
Loop

DataBind: (From MSDN Library Help)
Private Sub DataList1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) _
Handles DataList1.ItemDataBound
Dim dob As DateTime
Dim doblabel As Label
doblabel = CType(e.Item.FindControl("Label1"), Label)
dob = CType(doblabel.Text, DateTime)
If dob.Month = Today.Month Then
e.Item.BackColor = Color.Yellow
End If
End Sub
Thanx

/Per W.
Nov 15 '06 #5

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

Similar topics

2
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember =...
3
by: Lerp | last post by:
Hi all, What's the syntax for creating a row out of the current item in a datagrid? Something like this ? Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)
6
by: enrique | last post by:
Hello, I simpy want to place a record ID into a session variable. I know how to create session variables, I'm just can't figure out the syntax for the record item when I'm working with a...
8
by: Joel Reinford | last post by:
I would like to build a class that has properties which can be accessed by string names or index numbers in the form of MyClass.Item("LastName"). The string names or item index values would be...
9
by: Capt_Ron | last post by:
Hello, I would like to set the value of the item in the checked list box. I have a datareader that has 2 columns. PK and TEXT I want the TEXT as the Item and the PK as the Value. I can not...
5
by: Cindy H | last post by:
Hi I have a ddl that I have populated with a dataset. I have 2 items in the ddl. The first one is '3D' and the second one is 'Spot'. I have to select Spot - the second item in the ddl and then...
3
by: Elmo Watson | last post by:
I previously had a project working, in which the Gridview was populated by a DataSet - then, with a DropDownlist in one of the columns, using the OnrowDataBound event, to populate the DDL with the...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
1
by: Sparkhill | last post by:
I have this page that prints out the contents of a table and commits it to a table. thus the string is full of all the data from the list. At the moment i have a add to basket button that redirect to...
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.