I have 2 to 10 Images saved into a DataSet DataTable. Currently the images all display on a my webpage using asp:DataList. I would like to convert the DataList to a 'Slider' style display. Only showing the first image unless the user clicks on the next button
to see more. I would like the number of image to to display (ex. 3 0f 7) with a next and prev button or link to see the next image.
I ended up using a GridView that refreshes the webpage when the Page Index Changes and then displays the image matching the page index session variable. Make sure to bind the grid after down.
ralco
Member
2 Points
14 Posts
Create Image Slider with C# generated datatable
Nov 21, 2012 09:52 PM|LINK
I have 2 to 10 Images saved into a DataSet DataTable. Currently the images all display on a my webpage using asp:DataList. I would like to convert the DataList to a 'Slider' style display. Only showing the first image unless the user clicks on the next button to see more. I would like the number of image to to display (ex. 3 0f 7) with a next and prev button or link to see the next image.
HTML is:
<asp:DataList ID="dtBGI" runat="server" RepeatDirection="Vertical">
<ItemTemplate>
<a href= '<%# Eval("ImageFilename")%>'rel="lightbox[roadtrip]" style="margin-left:20px;"><img width='610' border= '0' height='350' src='<%# Eval("LinkFileName")%>' alt="" /> </a>
</ItemTemplate>
</asp:DataList>
C# is:
// Create the data table to hold the Background Images Data (BGI)
DataSet BGI_DS = new DataSet();
DataTable BGI_Table = BGI_DS.Tables.Add();
BGI_Table.Columns.Add("LinkFileName", typeof(string));
BGI_Table.Columns.Add("ImageFilename", typeof(string));
//Background Images
foreach (var y in overview.BackgroundImages)
{
BGI_Table.Rows.Add("/App_Images/" + y.DocumentName, "/App_Images/" + y.DocumentId);
}
Please help me find a solution. Thanks in advance!!!
asteranup
All-Star
30184 Points
4906 Posts
Re: Create Image Slider with C# generated datatable
Nov 22, 2012 01:51 AM|LINK
Hi,
You can check these posts-
http://delicious.com/anupdg/slideshow+database
All are done with inmimory object. You can convert them to database.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
chetankotwal
Member
7 Points
28 Posts
Re: Create Image Slider with C# generated datatable
Mar 12, 2013 11:05 AM|LINK
i check all this link but still my problem is not resolved.please give me a simple method to attached image with slider.
can we use asp:repeater for that??
if yes then how we can use it??
please guide me for that....
and again thankfull to all
regards
chetan
ralco
Member
2 Points
14 Posts
Re: Create Image Slider with C# generated datatable
Mar 12, 2013 03:39 PM|LINK
I ended up using a GridView that refreshes the webpage when the Page Index Changes and then displays the image matching the page index session variable. Make sure to bind the grid after down.
<asp:GridView ID="dtBGI" runat="server" AutoGenerateColumns="false"
border="0" AllowPaging="true" PageSize="1" onpageindexchanging="dtBGI_PageIndexChanging"
GridLines="None" BorderStyle="Solid" BorderWidth="3px"
CssClass="techBGITable" BorderColor="Gray">
<PagerSettings FirstPageText="First" LastPageText="Last" NextPageText="Next"
PreviousPageText="Previous" Mode="NumericFirstLast"/>
<PagerStyle HorizontalAlign="Center" />
<Columns>
<asp:TemplateField>
<HeaderStyle/>
<ItemTemplate>
<table width="100%">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60px" height="60px">
<img width='555' border= '0' height='320' src='<%# Eval("LinkFileName")%>' alt="" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code behind
protected void dtBGI_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Session["PageIndex" + intCategoryID + intFamilyID] = e.NewPageIndex;
BuildTechContent(); //used to rebuild the page again
}