daer sir
image gallery of datalist in next and previous button.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhijit PatilPosted Mar 7, 2014, 2:18 AM
please see the below link
http://csharpdotnetfreak.blogspot.com/2009/06/images-in-gridview-objectdatasource.html
saswat kumarPosted Mar 7, 2014, 2:16 AM
i have datalaist control to show image gallery.ihave taken' repeatcolumn=5' on datalist
control.afterthat i want to take next and previous button to show 5 image serially from databse.
Abhijit PatilPosted Mar 7, 2014, 1:54 AM
hey saswat kumar
use the c# code
public DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn ("PictureID", typeof(int))); dt.Columns.Add(new DataColumn ("PictureURL", typeof(string))); dt.Columns.Add(new DataColumn ("Title", typeof(string))); DataRow dr = dt.NewRow(); dr["PictureID"] = 1; dr["PictureURL"] = ResolveUrl ("~/Images/Ball1.gif"); dr["Title"] = "FootBall"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["PictureID"] = 2; dr["PictureURL"] = "~/Images/Mobiles.jpg"; dr["Title"] = "Mobile Phones"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["PictureID"] = 3; dr["PictureURL"] = "~/Images/Watch.jpg"; dr["Title"] = "Watches"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["PictureID"] = 4; dr["PictureURL"] = "~/Images/Perfumes.jpg"; dr["Title"] = "Perfumes"; dt.Rows.Add(dr); return dt; }
HTML Source Code:
<asp:GridView ID="GridView1" Runat="server" AutoGenerateColumns="False" BorderWidth="1px" CellPadding="3" BorderStyle="None" BorderColor="#CCCCCC" DataSourceID="ObjectDataSource1" AllowPaging="True" PageSize=3> <PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White"> PagerStyle> <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#006699"> HeaderStyle> <Columns> <asp:BoundField HeaderText="Picutre ID" DataField="PictureID"> <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"> ItemStyle> asp:BoundField> <asp:BoundField HeaderText="Title" DataField="Title"> asp:BoundField> <asp:ImageField DataImageUrlField="PictureURL"> asp:ImageField> Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#669999">SelectedRowStyle> <RowStyle ForeColor="#000066">RowStyle> asp:GridView> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="ImagesInGridView"> asp:ObjectDataSource>
hope it helps
Regards,
Abhijit Patil.
http://dotnetbyabhipatil.blogspot.in
KalaiPosted Mar 7, 2014, 12:53 AM