Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
hi all,

i need to make an image slideshow using database

i have this table which store images in database

table [ images]

title
imagepath
imageurl

________________________

thanks,
Ranya
Posted
Updated 28-Dec-11 17:16pm
v2
Comments
fjdiewornncalwe 28-Dec-11 23:18pm    
If you are looking for approval to go ahead, then you have it. We do not do your homework for you. You need to make a legitimate attempt on your own. When you run into problems in your code, then post questions related to the code in question. Basically, ask a more specific question.
Sergey Alexandrovich Kryukov 28-Dec-11 23:31pm    
Such posts should be reported as "not a question". The number of non-questions in this forum grows and threatens to overwhelm legitimate questions. We need to curb this, as this spam absorbs too much attention and goes at the expense of people who really deserve help.
--SA
Karthik Harve 28-Dec-11 23:37pm    
Absolutely true. people should understand this.
shms_rony 29-Dec-11 5:13am    
What do you say
You do not want to help anyone
I have a problem and you want to solve and I went to this site to answer me one of you
But you do not do you deal professionally
There are so many sites out and I put my question is answered with an open mind

If you look at the bottom you will find the solution in question is not that strange
And a person understand the question and answer it

I'm at the beginning of my work and I am having problems and I come to those who understand and help me to answer

Thank you

1 solution

Hi,

Use Ajax Tool kit control for this task..


XML
<div>
        <div>
             <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
             </asp:ToolkitScriptManager>
             <asp:Image ID="img1" runat="server"
             Height="400px" Width="400px"
             ImageUrl="~/Image/2Desert.jpg" />
        </div>
        <asp:SlideShowExtender ID="SlideShowExtender1" runat="server"
BehaviorID="SSBehaviorID"
            TargetControlID="img1"
            SlideShowServiceMethod="GetSlides"
            AutoPlay="true"
            ImageDescriptionLabelID="lblDesc"
            NextButtonID="btnNext"
            PreviousButtonID="btnPrev"
            PlayButtonID="btnPlay"
            PlayButtonText="Play"
            StopButtonText="Stop"
            Loop="true" >
        </asp:SlideShowExtender>
    </div>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td align="center" >
     <div>
            <asp:Label ID="lblDesc" runat="server" Text=""></asp:Label><br />
            <asp:Button ID="btnPrev" runat="server" Text="Previous" />
            <asp:Button ID="btnPlay" runat="server" Text="" />
            <asp:Button ID="btnNext" runat="server" Text="Next" />
        </div>
    </td>
    </tr>
    </table>
    </div>



*****C# code

VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    loadslide()

End Sub

Sub loadslide()

    con.ConnectionString = ConfigurationManager.ConnectionStrings("con").ConnectionString

    fselect = "select * from imgurl"

    sqlcmd = New SqlCommand(fselect, con)

    con.Open()

    sqladp = New SqlDataAdapter(sqlcmd)

    con.Close()

    dt1.Clear()

    sqladp.Fill(dt1)

End Sub


Here I added the images url form the database by using datatable.

Slide show require images it has supply from GetSlide method. Add

the below pagemethod in your serverside coding.

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)

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

        Next

        Return (imgSlide)

    End Function


Regards,

Sucharitha

I hope this one hepfull to u
 
Share this answer
 
v4
Comments
Baraa Oraibi 25-Nov-14 8:34am    
not workig

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