Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i made a wep page and added a Slide Show and imagebutton {to make it clickable} to it
And link the slide show with ACCESS database using a Web service
the code of Web service was like that
_
VB
Public Shared Function GetSlides() As AjaxControlToolkit.Slide()

Dim imgSlide As AjaxControlToolkit.Slide() = New AjaxControlToolkit.Slide(dt1.Rows.Count - 1) {}
For i As Integer = 0 To dt1.Rows.Count - 1
Dim dr As DataRow = dt1.Rows(i)
imgSlide(i) = New AjaxControlToolkit.Slide(Replace(dr("LINKIMG").ToString(), "~/", ""), "", "")
Next
Return (imgSlide)

End Function

and in page load I use this sub
VB
Sub loadslide()
con1.ConnectionString = ConfigurationManager.ConnectionStrings("con").ToString
fselect = "select * from VIDEO"
sqlcmd = New OleDb.OleDbCommand(fselect, con1)
If con1.State = ConnectionState.Closed Then
con1.Open()
End If

sqladp = New OleDb.OleDbDataAdapter(sqlcmd)
con1.Close()
dt1.Clear()
sqladp.Fill(dt1)
End Sub

Now all what i want is to attach the click event for each image when the user click on it and link it with a URL using a text field from my database
In other words
I want to make each image as a single Link dynamically
Thank you very much for your interest to read my question
Posted
Updated 13-Jan-12 5:29am
v2

1 solution

Thank you very much
The problem has been resolved
______________________________________
code of Web service
VB
<system.web.services.webmethod(),> _
   Public Shared Function GetSlides() As AjaxControlToolkit.Slide()

       Dim imgSlide As AjaxControlToolkit.Slide() = New AjaxControlToolkit.Slide(dt1.Rows.Count - 1) {}
       For i As Integer = 0 To dt1.Rows.Count - 1
           Dim dr As DataRow = dt1.Rows(i)
           Dim hass As String
           hass = "<a href="" + dr("linkpost").ToString() + "" target="_blank"><img alt="" + dr("linktext").ToString() + "" width="200px" height="200px" src="" + dr("keyword").ToString() + "" /></a>"

           imgSlide(i) = New AjaxControlToolkit.Slide(Replace(dr("LINKIMG").ToString(), "~/", ""), hass, hass)

              Next
       Return (imgSlide)

   End Function



and go to
VB
source
then
VB
imagebutton1
and make
VB
style="display: none


it worked fine
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900