G
Guest
I would like to accomplish the following task in WebForm.aspx
I have a SQL SELECT query that INNER JOIN two tables (Device_Tbl and Detail_Tbl) which will return
Device_BtnID Status Z_Index Left_Px Top_Px On_Img Off_Im
ImgBtnLight 0 102 192px 72px image\light_on.gif image\light_off.gi
ImgBtnAC 0 102 192px 72px image\ac_on.gif image\ac_off.gi
Based on the return result, I would like to something like this
Dim status As Boolean = dr("Status"
Dim img As Strin
If (status = False) The
img = dr("Off_Img_File"
ElseIf (status = True) The
img = dr("On_Img_File"
End I
imgA.ID = dr("Device_BtnID"
With img
.ImageUrl = im
.Attributes("style") = "Z-INDEX:" & dr("Z_Index") & "; LEFT: " & dr("Left_Px") & "; POSITION: absolute; TOP:" & dr("Top_Px"
End Wit
Panel1.Controls.Add(imgA
I wrote the above codes to load the image for the image button according to its on/off status as well as its coordinate on the WebForm.aspx from the database. However it is working for just one image button. I would like to load lots of image button based on the data return from the SELECT query. Therefore before the end of data reutn from the query, I would like to do the same thing as above. Can anyone please help me on this issue
I used DataReader to load one image button, I wonder should I use DataReader or DataAdapter if loading lots of image buttons. In additon, how to loads the tables (Inner Join two tables) from the query to DataTable?
Thanks
Ester
I have a SQL SELECT query that INNER JOIN two tables (Device_Tbl and Detail_Tbl) which will return
Device_BtnID Status Z_Index Left_Px Top_Px On_Img Off_Im
ImgBtnLight 0 102 192px 72px image\light_on.gif image\light_off.gi
ImgBtnAC 0 102 192px 72px image\ac_on.gif image\ac_off.gi
Based on the return result, I would like to something like this
Dim status As Boolean = dr("Status"
Dim img As Strin
If (status = False) The
img = dr("Off_Img_File"
ElseIf (status = True) The
img = dr("On_Img_File"
End I
imgA.ID = dr("Device_BtnID"
With img
.ImageUrl = im
.Attributes("style") = "Z-INDEX:" & dr("Z_Index") & "; LEFT: " & dr("Left_Px") & "; POSITION: absolute; TOP:" & dr("Top_Px"
End Wit
Panel1.Controls.Add(imgA
I wrote the above codes to load the image for the image button according to its on/off status as well as its coordinate on the WebForm.aspx from the database. However it is working for just one image button. I would like to load lots of image button based on the data return from the SELECT query. Therefore before the end of data reutn from the query, I would like to do the same thing as above. Can anyone please help me on this issue
I used DataReader to load one image button, I wonder should I use DataReader or DataAdapter if loading lots of image buttons. In additon, how to loads the tables (Inner Join two tables) from the query to DataTable?
Thanks
Ester