Why ImageButton Display Text SubmitQuery Runtime - asp.net

i use imagebutton in datalist and set codeexpression :Eval("PictureUrl", "ProductImages\thumb_{0}") and runtime display submitquery.
<asp:DataList ID="DataList1" runat="server" DataKeyField="pid"
DataSourceID="SqlDataSource1">
<ItemTemplate>
pname:
<asp:Label ID="pnameLabel" runat="server" Text='<%# Eval("pname") %>' />
<br />
pprice:
<asp:Label ID="ppriceLabel" runat="server" Text='<%# Eval("pprice") %>' />
<br />
publisher:
<asp:Label ID="publisherLabel" runat="server" Text='<%# Eval("publisher") %>' />
<br />
writer:
<asp:Label ID="writerLabel" runat="server" Text='<%# Eval("writer") %>' />
<br />
<asp:ImageButton ID="ImageButton7" runat="server"
ImageUrl='<%# Eval("PictureUrl", "ProductImages\thumb_{0}") %>' />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbpath %>"
SelectCommand="SELECT [pname], [pprice], [PictureUrl], [gid], [storeid], [publisher], [writer], [pid] FROM [tblproduct]">
</asp:SqlDataSource>
output one record:
pname:
<span id="ContentPlaceHolder1_DataList1_pnameLabel_0">تکنیک عکاسی</span>
<br />
pprice:
<span id="ContentPlaceHolder1_DataList1_ppriceLabel_0">125000 </span>
<br />
publisher:
<span id="ContentPlaceHolder1_DataList1_publisherLabel_0">اسرار دانش</span>
<br />
writer:
<span id="ContentPlaceHolder1_DataList1_writerLabel_0">نصرالله کسرائیان</span>
<br />
<input type="image" name="ctl00$ContentPlaceHolder1$DataList1$ctl00$ImageButton7" id="ContentPlaceHolder1_DataList1_ImageButton7_0" src="ProductImages%09humb_~/image/tecnikakasi.jpg" />

You got the correct HTML rendered
<asp:ImageButton ID="ImageButton7" runat="server"
ImageUrl='<%# Eval("PictureUrl", "ProductImages\thumb_{0}") %>' />
will produce input tag with type=image
<input type="image" name="ctl00$ContentPlaceHolder1$DataList1$ctl00$ImageButton7" id="ContentPlaceHolder1_DataList1_ImageButton7_0" src="ProductImages%09humb_~/image/tecnikakasi.jpg" />
The problem is ProductImages%09humb_~/image/tecnikakasi.jpg not exists. It may be wrong.
Check the relative path rendered.
Try
ImageUrl='<%# Eval("PictureUrl", "~/ProductImages/thumb_{0}") %>'

It is displaying "SubmitQuery" because your image is not being loaded. If your writer alternate text, then alternate text will be displayed.
You can view source of the generated html and check the path of the image and try to correct it for resolving this problem.
ImageUrl='<%# Eval("PictureUrl", "{0}") %>'

Related

Image is not showing up in Listview from Database Visual Studio asp.net

I a quite new to Visual Studio and .net. So I am basically trying to get an image to show up from a connected Database. I have all the information showing just not the image. Here is the code needed to see if anyone can correct the error. Its probably something simple but as I said I'm new to all this.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:photochunkConnectionString %>' SelectCommand="SELECT [PhotoName], [Details], [Image], [UploadDate], [PhotoTypeID] FROM [Photos] ORDER BY [UploadDate]"></asp:SqlDataSource>
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
<AlternatingItemTemplate>
<span style="">PhotoName:
<asp:Label Text='<%# Eval("PhotoName") %>' runat="server" ID="PhotoNameLabel" /><br />
Details:
<asp:Label Text='<%# Eval("Details") %>' runat="server" ID="DetailsLabel" /><br />
Image:
<asp:Image ImageURL='<%# Eval("Image") %>' runat="server" ID="ImageLabel" Width="200px" /><br />
UploadDate:
<asp:Label Text='<%# Eval("UploadDate") %>' runat="server" ID="UploadDateLabel" /><br />
PhotoTypeID:
<asp:Label Text='<%# Eval("PhotoTypeID") %>' runat="server" ID="PhotoTypeIDLabel" /><br />
<br />
</span>
</AlternatingItemTemplate>

Passing Eval Through Command Argument in Listview

I have a link button that I am trying to pass a parameter through into the OnClick event handler. To do this I am using the CommandArgument field.
I have this link button within a listview so I am retireving the data using Eval, so I want to pass that value into the CommandArgument as such:
<asp:LinkButton id="BTN_ApproveTicket" runat="server" CommandArgument="<%#Eval("TicketNum").ToString()%>" OnClick="BTN_ApproveTicket_Click">
</asp:LinkButton>
I am doing this exact think with some table elements in my page, but this one is not working.
The error that I am getting is it is taking the <%#Eval("TicketNum").ToString() as a literal, so I am getting a server tag is not well formatted error. Any ideas on how to fix this would be greatly appreciated.
This is the AlternatingItemTemplate that is in question:
<AlternatingItemTemplate>
<td style="<%#setTicketClass(Eval("TicketNum").ToString(), Eval("UnitID").ToString(), Eval("TicketDate").ToString())%>" >
<asp:LinkButton id="BTN_ApproveTicket" runat="server" CommandArgument='<%#Eval("TicketNum").ToString()%>' OnClick="BTN_ApproveTicket_Click">
<i class="fa fa-check-square-o" style="<%#setCheckBoxClass(Eval("Approved").ToString())%>" ></i>
</asp:LinkButton>
<br />
<br />
JobID:
<asp:Label ID="JobIDLabel" runat="server" Text='<%# Eval("JobID") %>' />
<br />
Ticket #:
<asp:Label ID="TicketNumLabel" runat="server" Text='<%# Eval("TicketNum") %>' />
<br />
Unit:
<asp:Label ID="UnitIDLabel" runat="server" Text='<%# Eval("UnitID") %>' />
<br />
Total Ticket Hours:
<asp:Label ID="TicketHoursLabel" runat="server" Text='<%# Eval("TicketHours") %>' />
<br />
Total Product:
<asp:Label ID="TicketProductLabel" runat="server" Text='<%# Eval("TicketProduct") %>' />
<br />
Ticket Date:
<asp:Label ID="TicketDateLabel" runat="server" Text='<%# Eval("TicketDate", "{0:MMM dd yyyy}") %>' />
<br />
Charge To Customer:
<asp:Label ID="ChargeToCustomerLabel" runat="server" Text='<%# Eval("ChargeToCustomer") %>' />
<br />
Received From Customer:
<asp:Label ID="RecievedToCuLabel" runat="server" Text='<%# Eval("RecievedToCu") %>' />
<br />
Deliver To Customer:
<asp:Label ID="DeliverTocu" runat="server" Text='<%# Eval("DeliverToCu") %>' />
<br />
Charged To LSD:
<asp:Label ID="LBL_ChargedToLSD" runat="server" Text='<%# Eval("ChargedToLSD") %>' />
<br />
Received From LSD:
<asp:Label ID="RecievedFromLSDLabel" runat="server" Text='<%# Eval("RecievedFromLSD") %>' />
<br />
Delivered To LSD:
<asp:Label ID="DeliveredToLSDLabel" runat="server" Text='<%# Eval("DeliveredToLSD") %>' />
<br />
Subtotal:
<asp:Label ID="SubtotalLabel" runat="server" Text='<%# Eval("Subtotal", "{0:C}") %>' Font-Bold="True" />
<br />
GST:
<asp:Label ID="GSTLabel" runat="server" Text='<%# Eval("GST", "{0:P}") %>' Font-Bold="True" />
<br />
Total:
<asp:Label ID="TotalLabel" runat="server" Text='<%# Eval("Total", "{0:C}") %>' Font-Bold="True" />
<br />
Job Notes:
<asp:Label ID="PreJobNotesLabel" runat="server" Text='<%# Eval("PreJobNotes") %>' />
<br />
Job Description:
<asp:Label ID="JobDescLabel" runat="server" Text='<%# Eval("JobDesc") %>' />
<br />
Time Created:
<asp:Label ID="TimeCreatedLabel" runat="server" Text='<%# Eval("TimeCreated", "{0: MMM-dd-yyyy HH:mm}") %>' />
<br />
Created By:
<asp:Label ID="CreatedByLabel" runat="server" Text='<%# Eval("CreatedBy") %>' />
<br />
<asp:LinkButton class="btn-inverse" id="EditButton" runat="server" CommandName="Edit" Text="Edit" Enabled='<%# checkButtonEnabled() %>' style="padding: 2px 8px; text-decoration: none; border: solid 1px;" >
<span class="glyphicon glyphicon-edit"></span> Edit
</asp:LinkButton>
<asp:LinkButton class="btn-inverse" id="DeleteButton" runat="server" CommandName="Delete" Text="Delete" onclientclick="return DeleteItem()" Enabled='<%# checkButtonEnabled() %>' style="padding: 2px 8px; text-decoration: none; border: solid 1px;" >
<span class="glyphicon glyphicon-trash"></span> Delete
</asp:LinkButton>
<asp:LinkButton class="btn-inverse" id="SelectButton" runat="server" CommandName="Select" Text="Show Product" style="padding: 2px 8px; text-decoration: none; border: solid 1px; white-space: nowrap;" >
<span class="glyphicon glyphicon-menu-down"></span> Show Product
</asp:LinkButton>
</td>
</AlternatingItemTemplate>
It might have to do with quotes - you are using double quotes everywhere, which may confuse parser. Try replacing outer ones with single quote:
CommandArgument='<%#Eval("TicketNum").ToString()%>'

Button refuses to work

I have a standard button which should call a method but it just refuses to work and I can't figure out why.
ASP code:
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button
ID="UploadButton" runat="server" onclick="UploadButton_Click" Text="Change Logo" />
Code behind:
protected void UploadButton_Click(object sender, EventArgs e)
{
PasswordLabel.Visible = true;
PasswordLabel.Text = "TEST Before";
Image_Inserting(this);
PasswordLabel.Text = "TEST After";
}
I just added the textbox methods to test it but it doesn't seem to be posting back (even when I remove Image_Inserting call). All other buttons work fine so I don't know why this one won't work.
EDIT: Whole page- Button code towards the bottom
<%# Page Title="" Language="C#" MasterPageFile="~/Standardmaster.Master" AutoEventWireup="true" CodeBehind="VendorAccount.aspx.cs" Inherits="PetShopParadise.Vendor_Pages.VendorAccount" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.style10
{
color: #FF0000;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" runat="server">
<h2>Account Details</h2>
<div id="RegistrationDiv">
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1">
<EditItemTemplate>
Name:
<asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br />
Phone_Number:
<asp:TextBox ID="Phone_NumberTextBox" runat="server"
Text='<%# Bind("Phone_Number") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
Name:
<asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br />
Phone_Number:
<asp:TextBox ID="Phone_NumberTextBox" runat="server"
Text='<%# Bind("Phone_Number") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Name:
<asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
<br />
Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
<br />
Phone Number:
<asp:Label ID="Phone_NumberLabel" runat="server"
Text='<%# Bind("Phone_Number") %>' />
<br />
<asp:Button ID="Button3" runat="server" Text="Edit Details" CommandName="Edit" />
<br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:PetShopParadiseConnectionString %>"
SelectCommand="SELECT [Name], [Address], [Phone_Number] FROM [Vendors] WHERE ([VendorID] = #VendorID)">
<SelectParameters>
<asp:SessionParameter Name="VendorID" SessionField="ID" Type="Decimal" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Table ID="Table1" runat="server" style="text-align:left;">
<asp:TableRow ID="TableRow4" runat="server">
<asp:TableCell ID="TableCell7" runat="server">Password</asp:TableCell><asp:TableCell ID="TableCell8" runat="server">
<asp:TextBox ID="PasswordBox" TextMode="Password" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
id="RequiredFieldValidator5"
runat="server"
ControlToValidate="PasswordBox"
Display="None"
Forecolor="Red"
ErrorMessage="Please enter a password." />
</asp:TableCell></asp:TableRow><asp:TableRow ID="TableRow5" runat="server">
<asp:TableCell ID="TableCell9" runat="server">Re-Enter Password</asp:TableCell><asp:TableCell ID="TableCell10" runat="server">
<asp:TextBox ID="PasswordCheckBox" TextMode="Password" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
id="RequiredFieldValidator6"
runat="server"
ControlToValidate="PasswordCheckBox"
Display="None"
Forecolor="Red"
ErrorMessage="Please re-enter your password." />
</asp:TableCell></asp:TableRow></asp:Table><asp:Label
ID="PasswordLabel" runat="server" Text="Password" CssClass="style10"></asp:Label><br />
<asp:Button ID="PasswordButton"
runat="server" Text="Update Password" onclick="PasswordButton_Click" /><br />
<asp:SqlDataSource
ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:PetShopParadiseConnectionString %>"
onselecting="SqlDataSource2_Selecting" SelectCommand="SELECT * FROM Vendors"
UpdateCommand="UPDATE [Vendors] SET [Password]=#passwordhash WHERE ([VendorID] = #VendorID)" OnUpdating="Parameters_Updating">
<UpdateParameters>
<asp:Parameter Name="Password" />
<asp:SessionParameter name="VendorID" sessionfield="ID" />
</UpdateParameters>
</asp:SqlDataSource>
<br /><asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button
ID="UploadButton" runat="server" onclick="UploadButton_Click" Text="Change Logo" /></div></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bannerContent" runat="server">
</asp:Content>
My guess is that it is causing other (possibly hidden) validation to run. Make sure to set CausesValidation to false.
quote :
*I just added the textbox methods *
I guess our trying to update a Password textBox which you can't.
only by :
PasswordLabel .Attributes["value"] = "aaa";

how can i use datapager with datalist?

i have a datalist and a datapager but when i run my program it have error.
Control 'DataList1' does not implement IPageableItemContainer.
what is problem?
<asp:DataList ID="DataList1" runat="server" DataKeyField="id"
DataSourceID="SqlDataSource1">
<ItemTemplate>
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
<br />
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
<br />
tedad:
<asp:Label ID="tedadLabel" runat="server" Text='<%# Eval("tedad") %>' />
<br />
group_id:
<asp:Label ID="group_idLabel" runat="server" Text='<%# Eval("group_id") %>' />
<br />
VDate:
<asp:Label ID="VDateLabel" runat="server" Text='<%# Eval("VDate") %>' />
<br />
KDate:
<asp:Label ID="KDateLabel" runat="server" Text='<%# Eval("KDate") %>' />
<br />
gheimat:
<asp:Label ID="gheimatLabel" runat="server" Text='<%# Eval("gheimat") %>' />
<br />
details:
<asp:Label ID="detailsLabel" runat="server" Text='<%# Eval("details") %>' />
<br />
imgae:
<asp:Label ID="imgaeLabel" runat="server" Text='<%# Eval("imgae") %>' />
<br />
"
SelectCommand="SELECT * FROM [Tbl_Kala_Group_No]">
<asp:DataPager ID="DataPager1" runat="server" PagedControlID = "DataList1" PageSize = "4" QueryStringField = "page" >
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
Datapager control does not support for DataList. it works with ListView.
so, Paging for DataList, you have create paging dynamically.
Just give in google : paging for Datalist, you will find lots of resource. Thank you.

how do i use a photo slide show inside listview?

how do i use a photo slide show inside listview??i am using jquery....the first row works fine..the pictures keep on looping...but in the next rows the pictures do not change..i mean its static...i am binding the image path from the columns"Image1" "Image2" "Image3".
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Restaurant.aspx.vb" Inherits="Restaurant" %>
<!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>
<link href="CSS_Styles/twoColFixLtHdr.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="CSS_Styles/Restaurant.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/jquery-1.4.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
/***
Simple jQuery Slideshow Script
Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc. Please link out to me if you like it :)
***/
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ($active.length == 0) $active = $('#slideshow IMG:last');
// use this to pull the images in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#slideshow IMG:first');
// uncomment the 3 lines below to pull the images in random order
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next = $( $sibs[ rndNum ] );
$active.addClass('last-active');
$next.css({ opacity: 0.0 })
.addClass('active')
.animate({ opacity: 1.0 }, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval("slideSwitch()", 5000);
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="container">
<div class="header">
<asp:LoginStatus ID="LoginStatus1" runat="server"
ForeColor="White"
CssClass="signin" />
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
CssClass="register"
ForeColor="White"
NavigateUrl="~/login.aspx">Register</asp:HyperLink>
<asp:Label ID="Label2" runat="server"
ForeColor="White"
CssClass="welcome">Welcome!Guest.
</asp:Label>
</AnonymousTemplate>
<LoggedInTemplate>
<asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/account.aspx"
ForeColor="White"
CssClass="myaccount"
ToolTip="Click here to go to your account page.">My Account</asp:HyperLink>
<asp:Label ID="Label2" runat="server"
ForeColor="White"
CssClass="welcome">Welcome!<asp:LoginName ID="LoginName2" runat="server" />
</asp:Label>
</LoggedInTemplate>
</asp:LoginView>
<!-- end .header --></div>
<div id="navPos">
<ul id="MenuBar1" class="MenuBarHorizontal">
<li>
<asp:HyperLink ID="Home" runat="server" NavigateUrl="~/homepage_aspx/homepage.aspx">Home</asp:HyperLink>
</li>
<li>
<asp:HyperLink ID="Products" runat="server" CssClass="MenuBarItemSubmenu">Products</asp:HyperLink>
<ul>
<li><asp:HyperLink ID="Groceries" runat="server">Groceries</asp:HyperLink></li>
<li><asp:HyperLink ID="DepartmentalItems" runat="server">Departmental Items</asp:HyperLink></li>
<li><asp:HyperLink ID="Electronics" runat="server">Electronics</asp:HyperLink>
<ul>
<li><asp:HyperLink ID="Mobiles" runat="server" NavigateUrl="~/itemsDisplayPage_aspx/itemsDisplayPage.aspx?typeOfItem=mobiles">Mobiles</asp:HyperLink></li>
<li><asp:HyperLink ID="Laptops" runat="server" NavigateUrl="~/itemsDisplayPage_aspx/itemsDisplayPage.aspx?typeOfItem=computers">Laptops & Computers</asp:HyperLink></li>
<li><asp:HyperLink ID="Accessories" runat="server">Accessories</asp:HyperLink></li>
</ul>
</li>
<li><asp:HyperLink ID="Kitchen" runat="server">Kitchen Items</asp:HyperLink></li>
<li><asp:HyperLink ID="HyperLink5" runat="server">HyperLink</asp:HyperLink></li>
<li><asp:HyperLink ID="HyperLink6" runat="server">HyperLink</asp:HyperLink></li>
</ul>
</li>
<li><asp:HyperLink ID="WhyUS" runat="server">Why Us</asp:HyperLink></li>
<li><asp:HyperLink ID="Payment" runat="server">Payment</asp:HyperLink></li>
<li><asp:HyperLink ID="Contact_Us" runat="server" NavigateUrl="ContactUs.aspx">Contact Us</asp:HyperLink></li>
<li><asp:HyperLink ID="AboutUs" runat="server">About Us</asp:HyperLink></li>
</ul>
</div><br /><br />
<div class="content1">
<div>
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
</div>
<br />
<!-- <div id="wrapper">
<div id="ResImage">
</div>
<div id="ResDesc">
<asp:Label ID="lblDesc" runat="server" Width="290px" Height="190px" BackColor="White">
Pay Rs 499 for MAKEOVER PACKAGE:
Revival Facial, Haircut, Hair Wash, Blow Dry,
Upper Lip & Eyebrows Threading worth
Rs 1480 # LAKME STUDIOS & SALONS, DELHI & NCR
(Valid at 16 outlets)</asp:Label>
</div>
<div id="ResPrice1">
<asp:Label ID="lblValue" runat="server" Text="Value" CssClass="ResValue"></asp:Label>
<asp:Label ID="lblDiscount" runat="server" Text="Discount" CssClass="ResDiscount"></asp:Label>
<asp:Label ID="lblYouPay" runat="server" Text="You Pay" CssClass="ResYouPay"></asp:Label>
<div id="ResPrice2">
<asp:Label ID="lblValueAmt" runat="server" Text="Rs.2000" CssClass="ResValueAmt"></asp:Label>
<asp:Label ID="lblDiscountAmt" runat="server" Text="Rs.6000" CssClass="ResDiscountAmt"></asp:Label>
<asp:Label ID="lblYouPayAmt" runat="server" Text="Rs.1400" CssClass="ResYouPayAmt"></asp:Label>
</div>
<asp:LinkButton ID="lnkGetCoupon" runat="server">Get Discount Coupon</asp:LinkButton>
</div>
<div id="HowItWorks">
<asp:Label ID="lblHowItWorks" runat="server" Text="How It Works?" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
<ul>
<li><asp:Label ID="Label3" runat="server" Text="1.Click on the 'Get Discount Coupon' button" Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label4" runat="server" Text="2.Get a print of your Voucher and carry it during your visit to the outlet." Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label5" runat="server" Text="3.Show your Voucher and pay the amount directly to the merchant. " Font-Size="10px"></asp:Label></li>
</ul>
</div>
</div> -->
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1"
DataKeyNames="OfferID" GroupItemCount="2" >
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>
No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<td runat="server" style="">
OfferID:
<asp:TextBox ID="OfferIDTextBox" runat="server" Text='<%# Bind("OfferID") %>' />
<br />
RestaurantID:
<asp:TextBox ID="RestaurantIDTextBox" runat="server"
Text='<%# Bind("RestaurantID") %>' />
<br />
Offer:
<asp:TextBox ID="OfferTextBox" runat="server" Text='<%# Bind("Offer") %>' />
<br />
Value:
<asp:TextBox ID="ValueTextBox" runat="server" Text='<%# Bind("Value") %>' />
<br />
Discount:
<asp:TextBox ID="DiscountTextBox" runat="server"
Text='<%# Bind("Discount") %>' />
<br />
YouPay:
<asp:TextBox ID="YouPayTextBox" runat="server" Text='<%# Bind("YouPay") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<br />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
<br />
</td>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="groupPlaceholderContainer" runat="server" border="0" style="">
<tr ID="groupPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
</td>
</tr>
</table>
</LayoutTemplate>
<EmptyItemTemplate>
<td runat="server" />
</EmptyItemTemplate>
<ItemTemplate>
<td runat="server" style="">
<div id="wrapper">
<div id="ResImage">
<div id="slideshow">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
<asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
<asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
</div>
</div>
<div id="ResDesc">
<asp:Label ID="lblDesc" runat="server" Width="290px" Height="190px" BackColor="White" Text='<%# Eval("Offer") %>'></asp:Label>
</div>
<div id="ResPrice1">
<asp:Label ID="lblValue" runat="server" Text="Value" CssClass="ResValue"></asp:Label>
<asp:Label ID="lblDiscount" runat="server" Text="Discount" CssClass="ResDiscount"></asp:Label>
<asp:Label ID="lblYouPay" runat="server" Text="You Pay" CssClass="ResYouPay"></asp:Label>
<div id="ResPrice2">
<asp:Label ID="lblValueAmt" runat="server" Text='<%# Eval("Value") %>' CssClass="ResValueAmt"></asp:Label>
<asp:Label ID="lblDiscountAmt" runat="server" Text='<%# Eval("Discount") %>' CssClass="ResDiscountAmt"></asp:Label>
<asp:Label ID="lblYouPayAmt" runat="server" Text='<%# Eval("YouPay") %>' CssClass="ResYouPayAmt"></asp:Label>
</div>
<asp:Label ID="lblRestaurantName" runat="server" Text='<%# Eval("RestaurantName") %>'></asp:Label><br />
<asp:LinkButton ID="lnkGetCoupon" runat="server">Get Discount Coupon</asp:LinkButton>
</div>
<div id="HowItWorks">
<asp:Label ID="lblHowItWorks" runat="server" Text="How It Works?" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
<ul>
<li><asp:Label ID="Label3" runat="server" Text="1.Click on the 'Get Discount Coupon' button" Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label4" runat="server" Text="2.Get a print of your Voucher and carry it during your visit to the outlet." Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label5" runat="server" Text="3.Show your Voucher and pay the amount directly to the merchant. " Font-Size="10px"></asp:Label></li>
</ul>
</div>
</div>
</td>
</ItemTemplate>
<AlternatingItemTemplate>
<td runat="server" style="">
<div id="wrapper">
<div id="ResImage">
<div id="slideshow">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
<asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
<asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
</div>
</div>
<div id="ResDesc">
<asp:Label ID="lblDesc" runat="server" Width="290px" Height="190px" BackColor="White" Text='<%# Eval("Offer") %>'></asp:Label>
</div>
<div id="ResPrice1">
<asp:Label ID="lblValue" runat="server" Text="Value" CssClass="ResValue"></asp:Label>
<asp:Label ID="lblDiscount" runat="server" Text="Discount" CssClass="ResDiscount"></asp:Label>
<asp:Label ID="lblYouPay" runat="server" Text="You Pay" CssClass="ResYouPay"></asp:Label>
<div id="ResPrice2">
<asp:Label ID="lblValueAmt" runat="server" Text='<%# Eval("Value") %>' CssClass="ResValueAmt"></asp:Label>
<asp:Label ID="lblDiscountAmt" runat="server" Text='<%# Eval("Discount") %>' CssClass="ResDiscountAmt"></asp:Label>
<asp:Label ID="lblYouPayAmt" runat="server" Text='<%# Eval("YouPay") %>' CssClass="ResYouPayAmt"></asp:Label>
</div>
<asp:Label ID="lblRestaurantName" runat="server" Text='<%# Eval("RestaurantName") %>'></asp:Label><br />
<asp:LinkButton ID="lnkGetCoupon" runat="server">Get Discount Coupon</asp:LinkButton>
</div>
<div id="HowItWorks">
<asp:Label ID="lblHowItWorks" runat="server" Text="How It Works?" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
<ul>
<li><asp:Label ID="Label3" runat="server" Text="1.Click on the 'Get Discount Coupon' button" Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label4" runat="server" Text="2.Get a print of your Voucher and carry it during your visit to the outlet." Font-Size="10px"></asp:Label></li>
<li><asp:Label ID="Label5" runat="server" Text="3.Show your Voucher and pay the amount directly to the merchant. " Font-Size="10px"></asp:Label></li>
</ul>
</div>
</div>
</td>
</AlternatingItemTemplate>
<EditItemTemplate>
<td runat="server" style="">
OfferID:
<asp:Label ID="OfferIDLabel1" runat="server" Text='<%# Eval("OfferID") %>' />
<br />
RestaurantID:
<asp:TextBox ID="RestaurantIDTextBox" runat="server"
Text='<%# Bind("RestaurantID") %>' />
<br />
Offer:
<asp:TextBox ID="OfferTextBox" runat="server" Text='<%# Bind("Offer") %>' />
<br />
Value:
<asp:TextBox ID="ValueTextBox" runat="server" Text='<%# Bind("Value") %>' />
<br />
Discount:
<asp:TextBox ID="DiscountTextBox" runat="server"
Text='<%# Bind("Discount") %>' />
<br />
YouPay:
<asp:TextBox ID="YouPayTextBox" runat="server" Text='<%# Bind("YouPay") %>' />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<br />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
<br />
</td>
</EditItemTemplate>
<GroupTemplate>
<tr ID="itemPlaceholderContainer" runat="server">
<td ID="itemPlaceholder" runat="server">
</td>
</tr>
</GroupTemplate>
<SelectedItemTemplate>
<td runat="server" style="">
OfferID:
<asp:Label ID="OfferIDLabel" runat="server" Text='<%# Eval("OfferID") %>' />
<br />
RestaurantID:
<asp:Label ID="RestaurantIDLabel" runat="server"
Text='<%# Eval("RestaurantID") %>' />
<br />
Offer:
<asp:Label ID="OfferLabel" runat="server" Text='<%# Eval("Offer") %>' />
<br />
Value:
<asp:Label ID="ValueLabel" runat="server" Text='<%# Eval("Value") %>' />
<br />
Discount:
<asp:Label ID="DiscountLabel" runat="server" Text='<%# Eval("Discount") %>' />
<br />
YouPay:
<asp:Label ID="YouPayLabel" runat="server" Text='<%# Eval("YouPay") %>' />
<br />
</td>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:databaseConnectionString %>"
SelectCommand="SELECT RestaurantOffers.RestaurantID, RestaurantOffers.Offer, RestaurantOffers.Value, RestaurantOffers.Discount, RestaurantOffers.YouPay, RestaurantName.RestaurantName, RestaurantName.Address, RestaurantName.PhoneNumber, RestaurantName.Image1, RestaurantName.Image2, RestaurantName.Image3, RestaurantOffers.OfferID FROM RestaurantName INNER JOIN RestaurantOffers ON RestaurantName.RestaurantID = RestaurantOffers.RestaurantID ORDER BY NEWID() "
ConflictDetection="CompareAllValues"
DeleteCommand="DELETE FROM [RestaurantOffers] WHERE [OfferID] = #original_OfferID AND [RestaurantID] = #original_RestaurantID AND (([Offer] = #original_Offer) OR ([Offer] IS NULL AND #original_Offer IS NULL)) AND (([Value] = #original_Value) OR ([Value] IS NULL AND #original_Value IS NULL)) AND (([Discount] = #original_Discount) OR ([Discount] IS NULL AND #original_Discount IS NULL)) AND (([YouPay] = #original_YouPay) OR ([YouPay] IS NULL AND #original_YouPay IS NULL))"
InsertCommand="INSERT INTO [RestaurantOffers] ([OfferID], [RestaurantID], [Offer], [Value], [Discount], [YouPay]) VALUES (#OfferID, #RestaurantID, #Offer, #Value, #Discount, #YouPay)"
OldValuesParameterFormatString="original_{0}"
UpdateCommand="UPDATE [RestaurantOffers] SET [RestaurantID] = #RestaurantID, [Offer] = #Offer, [Value] = #Value, [Discount] = #Discount, [YouPay] = #YouPay WHERE [OfferID] = #original_OfferID AND [RestaurantID] = #original_RestaurantID AND (([Offer] = #original_Offer) OR ([Offer] IS NULL AND #original_Offer IS NULL)) AND (([Value] = #original_Value) OR ([Value] IS NULL AND #original_Value IS NULL)) AND (([Discount] = #original_Discount) OR ([Discount] IS NULL AND #original_Discount IS NULL)) AND (([YouPay] = #original_YouPay) OR ([YouPay] IS NULL AND #original_YouPay IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_OfferID" Type="String" />
<asp:Parameter Name="original_RestaurantID" Type="String" />
<asp:Parameter Name="original_Offer" Type="String" />
<asp:Parameter Name="original_Value" Type="String" />
<asp:Parameter Name="original_Discount" Type="String" />
<asp:Parameter Name="original_YouPay" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="RestaurantID" Type="String" />
<asp:Parameter Name="Offer" Type="String" />
<asp:Parameter Name="Value" Type="String" />
<asp:Parameter Name="Discount" Type="String" />
<asp:Parameter Name="YouPay" Type="String" />
<asp:Parameter Name="original_OfferID" Type="String" />
<asp:Parameter Name="original_RestaurantID" Type="String" />
<asp:Parameter Name="original_Offer" Type="String" />
<asp:Parameter Name="original_Value" Type="String" />
<asp:Parameter Name="original_Discount" Type="String" />
<asp:Parameter Name="original_YouPay" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="OfferID" Type="String" />
<asp:Parameter Name="RestaurantID" Type="String" />
<asp:Parameter Name="Offer" Type="String" />
<asp:Parameter Name="Value" Type="String" />
<asp:Parameter Name="Discount" Type="String" />
<asp:Parameter Name="YouPay" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<!-- end .content --></div>
<div class="footer">
<!-- end .footer --></div>
<!-- end .container --></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", { imgDown: "SpryAssets/SpryMenuBarDownHover.gif", imgRight: "SpryAssets/SpryMenuBarRightHover.gif" });
</script>
</form>
</body>
</html>
jQuery is only finding the first row in the list view marked with an id of slideshow. From http://api.jquery.com/id-selector/:
For id selectors, jQuery uses the
JavaScript function
document.getElementById(), which is
extremely efficient.
Each id value must be used only once
within a document. If more than one
element has been assigned the same ID,
queries that use that ID will only
select the first matched element in
the DOM. This behavior should not be
relied on, however; a document with
more than one element using the same
ID is invalid.
Try using a class instead to select your elements.
I didn't try this, but just trying to get you in the right direction... change:
<div id="slideshow">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
<asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
<asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
</div>
to
<div class="slideshow">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
<asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
<asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
</div>
and anywhere your jquery has #slideshow to .slideshow

Resources