ASPx代碼
<ItemTemplate>
<a href="#" onclick="newimg('<%# Eval("ImageUrl", "/PackNet/ProductIMG/...{0}") %>')">
<ASP:Image ID="Image1" runat="server" Height="70px" Width="70px"
ImageUrl='<%# Eval("ImageUrl", "/PackNet/ProductIMG/{0}") %>' /></a>
</ItemTemplate>
雖然gridview提供ImageFIEld,但是它自動適應圖片大小 不怎麼好用 所以直接用Image綁定路徑
彈出頁面
function showvIEw(productID) {
newwin=window.open('about:blank','','width=600,height=450');
newwin.window.location.href="Detailed.ASPx?ID="+productID;
}
ASPx頁面中
<ASP:Button ID="btnDetailed" runat="server"
CommandArgument='<%# Eval("ProductID") %>'
CommandName="detailed" CSSClass="btn" Text="詳細>>" Width="70px" OnLoad="btnDetailed_Load" CausesValidation="False" UseSubmitBehavior="False" />
cs代碼
protected void btnDetailed_Load(object sender, EventArgs e)
{
((Button)sender).Attributes.Add("onclick", "showvIEw(" + ((Button)sender).CommandArgument.ToString() + ")");
}