Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing values of a Dataset to Imagebuttons. 1

Status
Not open for further replies.

lunargirrl

Programmer
Jan 26, 2004
77
BR
I am receiving data from a table (via sql query) like:
Cod_Module
--------
1
2
3

In my asp.net app (vb - codebehind) I receive these data using a sql query, my problem is: i have to check for the numbers that come from my query and based on that set to visible or visible some imagebuttons.
e.g
If my query returned the values 1 and 2, I have to set the ImageButton1 and ImageButton2 to visible and ImageButton3 to invisible.

I dont find a way to do that, because my dataset (i have to use dataset) returns the values and how can i get this values and make a comparation with the imagebuttons ???
My god, have no idea!

Thanks a lot,
Gis.
 
How about this - loop through the datatable and check the value the "Cod_Module" column in each row.
Code:
Dim row as DataRow
For Each row in YourDataSet.Tables.Item(0).Rows
    dim val as Int32
    val = Int32.Parse(row("Cod_Module").ToString())
    If (val.Equals(1)) Then ImageButton1.Visible= True
    If (val.Equals(2)) Then ImageButton2.Visible= True
    If (val.Equals(3)) Then ImageButton3.Visible= True
End For

Does that look right?

Greetings,
Dragonwell
 
dragon: excellent piece of script for working with DataSets -- doing a review on that topic currently - thanks!
 
np - it does seem like an odd request and I'm still not sure its the best answer.. Must be using a legacy database ;)



Greetings,
Dragonwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top