<%@ Page Title="" Language="C#" MasterPageFile="~/shopmaster.master" AutoEventWireup="true" CodeFile="Productdetails.aspx.cs" Inherits="Productdetails" %> <%@ MasterType VirtualPath="~/shopmaster.master" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:DataList ID="DataList1" runat="server" DataKeyField="pcode" DataSourceID="SqlDataSource1"> <ItemTemplate> <div style="width:100%"> <table style="width: 45%; float:left"> <tr> <td> <asp:Image ID="Image1" runat="server" Height="100%" ImageUrl='<%# Eval("image")%>' Width="90%" /> </td> </tr> </table> <table style="width: 50%; float:right"> <tr> <td> <span style="color: #FF0000">Product Neme</span>:<asp:Label ID="Label1" runat="server" Text='<%# Eval("pname")%>'></asp:Label> <br /><br /> <span style="color: #FF0000">Product Code</span>:<asp:Label ID="Label2" runat="server" Text='<%# Eval("pcode")%>'></asp:Label> <br /><br /> <span style="color: #FF0000">Product Description</span>:<asp:Label ID="Label3" runat="server" Text='<%# Eval("description")%>'></asp:Label> <br /><br /><br /> <span style="color: #FF0000">Price</span>:Rs.<asp:Label ID="Label4" runat="server" Text='<%# Eval("price")%>'></asp:Label> <br /><br /><br /> <asp:ImageButton ID="ImageButton1" runat="server" Height="39px" ImageUrl="~/web/images/add-to-cart-button-blue.png" onclick="ImageButton1_Click1" PostBackUrl='<%# Eval("pcode","cart.aspx?pcode={0}") %>' Width="147px" /> <br /> </td> </tr> </table> </div> <br /> <br /> <br /> <br /> <br /> </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [pname], [pcode], [image], [description], [price] FROM [products] WHERE ([pcode] = @pcode)"> <SelectParameters> <asp:QueryStringParameter Name="pcode" QueryStringField="pcode" Type="Decimal" /> </SelectParameters> </asp:SqlDataSource> </asp:Content>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Configuration; using System.Data.SqlClient; using System.IO; using System.Data; public partial class Productdetails : System.Web.UI.Page { string un; protected void Page_Load(object sender, EventArgs e) { if (this.Master.FindControl("Label_UserName").Visible == false) { DataList1.FindControl("ImageButton1").Visible = false; } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { } protected void DataList1_SelectedIndexChanged(object sender, EventArgs e) { } protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { } protected void ImageButton1_Click1(object sender, ImageClickEventArgs e) { } }
V e r y s l o w
DataList1.FindControl("ImageButton1")
ImageButton1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)