Gridview with Image缩略图,然后使用asp.net中的vb代码单击Image打开详细信息 [英] Gridview with Image thumbnail and click Image open details using vb code behind in asp.net

查看:48
本文介绍了Gridview with Image缩略图,然后使用asp.net中的vb代码单击Image打开详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用asp:gridview标签创建一个电影列表,然后在gridview中。我使用asp:imagebutton作为缩略图小jpg照片,当点击图像时,它将打开带有更大的新png文件的新窗口。我想在后面使用vb代码并以编程方式更改缩略图图像和大png文件。像aspx html页面的示例代码和后面的aspx.vb示例代码。任何帮助将不胜感激..

推荐答案

这是我的default.aspx代码

------- ----------------------

< asp:gridview id =GridView1runat =serverxmlns:asp = #unknown>

DataSource ='<%#GetData()%>'AutoGenerateColumns =FalseAllowPaging =True

BorderWidth =1px BackColor =WhiteCellPadding =3BorderStyle =None

BorderColor =#CCCCCC字体名称=Arial>

< footerstyle forecolor =#000066backcolor =白色>

< pagerstyle forecolor =#000066horizo​​ntalalign =Left>

BackColor =White> ;

< headerstyle forecolor =Whitefont-bold =True>

BackColor =#006699>

<列> < asp:boundfield headertext =Numdatafield =NumID>

< itemstyle horizo​​ntalalign =Centerverticalalign =Middle>





< asp:templatefield headertext =状态itemstyle-horizo​​ntalalign =中心>

< itemtemplate>

< asp:image id =completedImagerunat =serverimageurl =<%#completedImage()%> alternatetext =>







< asp:boundfield headertext =Titledatafield = titlesortexpression =Title>

< asp:boundfield headertext =Date Addeddatafield =DateAddeddataformatstring ={0:d}> < itemstyle horizo​​ntalalign =Center>



< asp:boundfield headertext =ISO Filedatafield =ISOFile>

< itemstyle horizo​​ntalalign =Center>



< asp:boundfield headertext =Mobiledatafield =MBFile>

< itemstyle horizo​​ntalalign =Center>



< asp:boundfield headertext =HD Filedatafield =HDFile>

< itemstyle horizo​​ntalalign =Center>



< asp:imagefield headertext =Picturedataimageurlfield =PictureURL>

ControlStyle-Height =150ControlStyle-宽度=105

alternatetext =电影照片

NullDisplayText =文件中没有图像。 readonly =true>

< controlstyle height =150pxwidth =105px>



< selectedrowstyle forecolor =白色font-bold =Truebackcolor =#669999>

< rowstyle forecolor =#000066>









这是default.aspx.vb代码:

---- ----------------------------------



Public Function completedImage()As String

completedImage =\ myFiles\KidPhoto.jpg

result =\ imagest /\\ yellow.gif
返回结果

结束功能





我无法定义和访问更改jpg照片和后面的代码中的gif照片。

gif照片显示正常,但不允许我点击照片并调出更大的jpg照片。请帮忙..
Here is my default.aspx code
-----------------------------
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
DataSource='<%# GetData() %>' AutoGenerateColumns="False" AllowPaging="True"
BorderWidth="1px" BackColor="White" CellPadding="3" BorderStyle="None"
BorderColor="#CCCCCC" Font-Names="Arial">
<footerstyle forecolor="#000066" backcolor="White">
<pagerstyle forecolor="#000066" horizontalalign="Left">
BackColor="White">
<headerstyle forecolor="White" font-bold="True">
BackColor="#006699">
<columns> <asp:boundfield headertext="Num" datafield="NumID">
<itemstyle horizontalalign="Center" verticalalign="Middle">


<asp:templatefield headertext="Status" itemstyle-horizontalalign="Center">
<itemtemplate>
<asp:image id="completedImage" runat="server" imageurl="<% # completedImage() %>" alternatetext="">



<asp:boundfield headertext="Title" datafield="Title" sortexpression="Title">
<asp:boundfield headertext="Date Added" datafield="DateAdded" dataformatstring="{0:d}"> <itemstyle horizontalalign="Center">

<asp:boundfield headertext="ISO File" datafield="ISOFile">
<itemstyle horizontalalign="Center">

<asp:boundfield headertext="Mobile" datafield="MBFile">
<itemstyle horizontalalign="Center">

<asp:boundfield headertext="HD File" datafield="HDFile">
<itemstyle horizontalalign="Center">

<asp:imagefield headertext="Picture" dataimageurlfield="PictureURL">
ControlStyle-Height="150" ControlStyle-Width="105"
alternatetext="Movie Photo"
NullDisplayText="No image on file." readonly="true">
<controlstyle height="150px" width="105px">

<selectedrowstyle forecolor="White" font-bold="True" backcolor="#669999">
<rowstyle forecolor="#000066">




Here is the default.aspx.vb codes:
--------------------------------------

Public Function completedImage() As String
completedImage = "\myFiles\KidPhoto.jpg"
result = "\images\yellow.gif"
Return result
End Function


I am unable to define and access to change the jpg photo and gif photo in code behind.
The gif photo show up fine but does not allow me to click photo and bring up the bigger jpg photo. Please help..


这篇关于Gridview with Image缩略图,然后使用asp.net中的vb代码单击Image打开详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆