Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I want to implement the slide show in c# .net with grid view control.

Right now I m fetching the data from the database and bind in the Gridview with the page size=1 and then giving the paging to display next.

Now i want to do same thing but no with the paging but after 10sec. the next record will be display automatically like the slide show. and at the last record it will again start from 1st record.

If anyone have an answer please send back to me
Posted
Comments
saud_a_k 7-Nov-12 4:07am    
Side show .. Reminds me of Spy Game
The PageIndexChanging event should help

Hi,

See my article if could help you.

An Outlook menu with "peekaboo" faded in slide show

Regards,
 
Share this answer
 
In the front end place the following code:




<asp:timer id="Timer1" runat="server" interval="3000" xmlns:asp="#unknown">

<asp:updatepanel id="Panel1" runat="server" xmlns:asp="#unknown">
<triggers> <asp:asyncpostbacktrigger controlid="Timer1" eventname="Tick">
<contenttemplate>
<asp:gridview id="gvAnnouncements" runat="server" autogeneratecolumns="False" pagesize="1">
AllowPaging="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None"
BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" Width="100%">
<pagersettings position="Bottom" lang="HTML">="NextPrevious" PreviousPageImageUrl="images/bullet_left.png"
NextPageImageUrl="images/bullet_right.png" />
<rowstyle backcolor="#F7F7DE">
<columns> <asp:boundfield datafield="Announcements" headertext="Announcements">
<footerstyle backcolor="#CCCC99">
<pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right">
<selectedrowstyle backcolor="#CE5D5A" font-bold="True" forecolor="White">
<headerstyle backcolor="#627B98" font-bold="True" forecolor="White" horizontalalign="Left">
Font-Size="14px" />
<alternatingrowstyle backcolor="White">





In the back end code paste the below code

Protected Sub Timer1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Load
If gvAnnouncements.PageCount <> 0 Then
If gvAnnouncements.PageIndex <> gvAnnouncements.PageCount - 1 Then
gvAnnouncements.PageIndex = DirectCast(gvAnnouncements.PageIndex, Integer) + 1
Else
gvAnnouncements.PageIndex = 0
End If
LoadAnnouncements()
End If
End Sub

Private Sub LoadAnnouncements()
Dim cmd As New OleDbCommand
cmd.CommandText = "select * from announcements order by ID desc"
Dim dt As DataTable = dblayer.LoadData(cmd)

gvAnnouncements.DataSource = dt
gvAnnouncements.DataBind()
End Sub

Protected Sub gvAnnouncements_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvAnnouncements.PageIndexChanging

gvAnnouncements.PageIndex = e.NewPageIndex
LoadAnnouncements()


End Sub
 
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