你好编码我搜索了很多但没找到我想要的东西
我有一个数据库,其中我有我的图像的路径..现在我用gridview绑定图像并在其上应用灯箱但我想要的是只显示前面的一个图像作为缩略图,当我点击该图像幻灯片放映将开始..
这是我的代码:
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
AutoGenerateColumns="False" PageSize="1" PersistedSelection="true" DatakeyNames="pptId">
<Columns>
<asp:BoundField headerText="pptId" DataField="pptId"></asp:BoundField>
<asp:TemplateField HeaderText="View PPT">
<ItemTemplate>
<a id="imageLink" href='<%# Eval("Imageurl") %>' title='<%#Eval("Description") %>'
rel="lightbox[Brussels]" runat="server">Show PPT</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<AlternatingRowStyle BackColor="White" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
<SortedAscendingCellStyle BackColor="#F5F7FB"></SortedAscendingCellStyle>
<SortedAscendingHeaderStyle BackColor="#6D95E1"></SortedAscendingHeaderStyle>
<SortedDescendingCellStyle BackColor="#E9EBEF"></SortedDescendingCellStyle>
<SortedDescendingHeaderStyle BackColor="#4870BE"></SortedDescendingHeaderStyle>
</asp:GridView>
这是我的aspx.cs页面代码:
protected void Page_Load(object sender, EventArgs e)
{
BindModule();
}
protected void BindModule()
{
try
{
con.Open();
string id = Request.QueryString["pptId"].ToString();
//Query to get ImagesName and Description from database
SqlCommand command = new SqlCommand("select * from Image_Master where pptId='" + id + "' and IsEnable='True' order by Priority", con);
dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(command);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
GridView1.Dispose();
}
catch (Exception ex)
{
Response.Write("Error occured : " + ex.Message.ToString());
}
finally
{
con.Close();
}
问题是,当我绑定gridview时,它将显示有关所选pptid的所有图像,当我点击任何图像时,我的sildeshow开始但我想要的只显示一个图像,当我点击该图像我的幻灯片开始。我使用lightbox进行幻灯片放映,我的图像来自数据库