单击后检索有关特定图像的数据

单击后检索有关特定图像的数据

本文介绍了单击后检索有关特定图像的数据.图像显示在gridview的imagebutton中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

只有图像显示在gridview中.我添加了ImageButton,图像显示在Image Button中.我想在单击后检索与特定图像有关的数据.

我的HTML代码如下所示


Only images are displaying in gridview.I have added ImageButton and image are showing in Image Button.I want to retrive data regarding to particular image after click.

My HTML CODE IS GIVEN BELOW


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Image.aspx.vb" Inherits="Image" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .griditem
        {}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
    <asp:GridView ID="gvShape" runat="server" AllowPaging="false"

            EditRowStyle-HorizontalAlign="Center" AutoGenerateColumns="False" Width ="100px"

            CellPadding="4" Font-Names="calibri" Font-Size="Small" ForeColor="#333333"

            PageSize="4">
            <RowStyle BackColor="#EFF3FB" Font-Names="calibri" HorizontalAlign="Left" />
            <Columns>
                <asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="false"/>
                <asp:ButtonField Text="DoubleClick" CommandName="DoubleClick" Visible="false"/>



               <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                            <asp:ImageButton ID="Image1" CommandName="DoubleClick" OnClick ="SingleClick" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image1") %>'/>
                        </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:ImageButton ID="Image2" CommandName="DoubleClick" OnClick ="SingleClick" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image2") %>'/>
                        </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:ImageButton ID="Image3" CommandName="DoubleClick" OnClick ="SingleClick" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image3") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:ImageButton ID="Image4" CommandName="DoubleClick" OnClick ="SingleClick" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image3") %>'/>
                            </ItemTemplate>
                </asp:TemplateField>

                <%--<asp:TemplateField HeaderText="">
                        <ItemTemplate>
                            <asp:ImageButton ID="Image1" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image1") %>/>
                        <asp:Image ID="Image1" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image1") %>'
                            />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:Image ID="Image2" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image2") %>'
                            />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:Image ID="Image3" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image3") %>'
                            />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                        <asp:Image ID="Image4" runat="server" Width="120" Height="100" ImageUrl='<%# "Handler.ashx?ImID=" + Eval("image4") %>'
                            />
                    </ItemTemplate>
                </asp:TemplateField>--%>
               </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" BorderStyle="None" />
        </asp:GridView>
        <br />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
   <%-- <asp:GridView ID="gvDtls" runat="server" AutoGenerateColumns="false" Width="83%"
                                border="0" AllowPaging="true" BorderColor="white"
            cssClass="griditem"   PageSize="10"  >
                                <PagerSettings Mode="Numeric"  Position="TopAndBottom"/>
                                <PagerStyle CssClass="mypager" HorizontalAlign="right" />
                                <Columns>
                                    <asp:TemplateField>
                                         <HeaderStyle CssClass="dispnone" />
                                        <ItemTemplate>
                                             <table width="100%">
                                                <tr>
                                                    <td class="bdr-grey">
                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0" Class="griditem" >
                                                            <tr>
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column1")%>
                                                              </td>
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column2")%>
                                                              </td>
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column3")%>
                                                              </td>
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column4")%>
                                                              </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>--%>
    </div>
    </form>
</body>
</html>

推荐答案


这篇关于单击后检索有关特定图像的数据.图像显示在gridview的imagebutton中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:59