G
Guest
Instead of drag and drop image button from Toolbox and name the image button id on the properties box, I would like to load image button ID from database. I created a database table that stores Image Button ID and Image (path name of the image for the image button). Example of the data will be: (ImgBtnLight, image\light.gif). The data type of the Image Button ID field in the database table is varchar whereas data type of image button in WebForm.aspx must be ImageButton.
For example, in database table: Image Button ID -> varchar -> 10 -> Not Null
In WebForm.aspx: Dim imgbtnid As ImageButton
Therefore I can't write the code as
Dim imgbtn As ImageButton = dr("Image Button ID"
imgbtn.ImageUrl = dr("Image"
The above codes will return error message
Exception Details: System.InvalidCastException: Specified cast is not valid
Can anyone please help me on this issue. The scenario is I must store the image button id in database and load it in WebForm.aspx. Thank you for your inputs
Thanks
Ester
For example, in database table: Image Button ID -> varchar -> 10 -> Not Null
In WebForm.aspx: Dim imgbtnid As ImageButton
Therefore I can't write the code as
Dim imgbtn As ImageButton = dr("Image Button ID"
imgbtn.ImageUrl = dr("Image"
The above codes will return error message
Exception Details: System.InvalidCastException: Specified cast is not valid
Can anyone please help me on this issue. The scenario is I must store the image button id in database and load it in WebForm.aspx. Thank you for your inputs
Thanks
Ester