how do i use a photo slide show inside listview? - asp.net

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

Related

ASP.NET Listview not saving edit

I am trying to use a listview to display and update marks.
The data displays without any issues, however when I click edit, then insert data and try to save the changes, the listview fails to do so and loads in the same state is was prior to the update attempt. Any ideas what is going on?
<asp:SqlDataSource ID="StudentResultsDS" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>"
SelectCommand="SELECT Module_Info.ModuleTitle, Module_Info.UserID, Module_Info.ModuleCode, Modules.ModuleMarks, Modules.MarkID, Modules.ExamMark, Modules.AssignmentMark, Users.SNumber, Lecturer_Records.UserID AS Expr1 FROM Module_Info INNER JOIN Modules ON Module_Info.ModuleID = Modules.ModuleID INNER JOIN Users ON Modules.UserID = Users.UserID INNER JOIN Lecturer_Records ON Users.UserID = Lecturer_Records.UserID WHERE (Lecturer_Records.UserID = #UserID)" UpdateCommand="UPDATE [Modules] SET [ModuleMarks]=#ModuleMarks WHERE [MarkID]=#MarkID" >
<UpdateParameters>
<asp:FormParameter Name="ModuleMarks" Type="String" />
<asp:FormParameter Name="MarkID" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="grabUserID" />
</SelectParameters>
</asp:SqlDataSource>
<!-- list view to display results-->
<header class="jumbotron hero-spacer">
<asp:ListView runat="server" ID="listviewid" DataSourceID="StudentResultsDS" DataKeyNames="ModuleMarks">
<AlternatingItemTemplate>
<span style="">ModuleTitle:
<asp:Label ID="ModuleTitleLabel" runat="server" Text='<%# Eval("ModuleTitle") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
ModuleCode:
<asp:Label ID="ModuleCodeLabel" runat="server" Text='<%# Eval("ModuleCode") %>' />
<br />
ModuleMarks:
<asp:Label ID="ModuleMarksLabel" runat="server" Text='<%# Eval("ModuleMarks") %>' />
<br />
MarkID:
<asp:Label ID="MarkIDLabel" runat="server" Text='<%# Eval("MarkID") %>' />
<br />
ExamMark:
<asp:Label ID="ExamMarkLabel" runat="server" Text='<%# Eval("ExamMark") %>' />
<br />
AssignmentMark:
<asp:Label ID="AssignmentMarkLabel" runat="server" Text='<%# Eval("AssignmentMark") %>' />
<br />
SNumber:
<asp:Label ID="SNumberLabel" runat="server" Text='<%# Eval("SNumber") %>' />
<br />
Expr1:
<asp:Label ID="Expr1Label" runat="server" Text='<%# Eval("Expr1") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
<br />
</span>
</AlternatingItemTemplate>
<EditItemTemplate>
<span style="">ModuleTitle:
<asp:TextBox ID="ModuleTitleTextBox" runat="server" Text='<%# Bind("ModuleTitle") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' />
<br />
ModuleCode:
<asp:TextBox ID="ModuleCodeTextBox" runat="server" Text='<%# Bind("ModuleCode") %>' />
<br />
ModuleMarks:
<asp:TextBox ID="ModuleMarksTextBox" runat="server" Text='<%# Bind("ModuleMarks") %>' />
<br />
MarkID:
<asp:Label ID="MarkIDLabel1" runat="server" Text='<%# Eval("MarkID") %>' />
<br />
ExamMark:
<asp:TextBox ID="ExamMarkTextBox" runat="server" Text='<%# Bind("ExamMark") %>' />
<br />
AssignmentMark:
<asp:TextBox ID="AssignmentMarkTextBox" runat="server" Text='<%# Bind("AssignmentMark") %>' />
<br />
SNumber:
<asp:TextBox ID="SNumberTextBox" runat="server" Text='<%# Bind("SNumber") %>' />
<br />
Expr1:
<asp:TextBox ID="Expr1TextBox" runat="server" Text='<%# Bind("Expr1") %>' />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
<br />
<br />
</span>
</EditItemTemplate>
<EmptyDataTemplate>
<span>No data was returned.</span>
</EmptyDataTemplate>
<InsertItemTemplate>
<span style="">ModuleTitle:
<asp:TextBox ID="ModuleTitleTextBox" runat="server" Text='<%# Bind("ModuleTitle") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' />
<br />
ModuleCode:
<asp:TextBox ID="ModuleCodeTextBox" runat="server" Text='<%# Bind("ModuleCode") %>' />
<br />
ModuleMarks:
<asp:TextBox ID="ModuleMarksTextBox" runat="server" Text='<%# Bind("ModuleMarks") %>' />
<br />
ExamMark:
<asp:TextBox ID="ExamMarkTextBox" runat="server" Text='<%# Bind("ExamMark") %>' />
<br />
AssignmentMark:
<asp:TextBox ID="AssignmentMarkTextBox" runat="server" Text='<%# Bind("AssignmentMark") %>' />
<br />
SNumber:
<asp:TextBox ID="SNumberTextBox" runat="server" Text='<%# Bind("SNumber") %>' />
<br />
Expr1:
<asp:TextBox ID="Expr1TextBox" runat="server" Text='<%# Bind("Expr1") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
<br />
<br />
</span>
</InsertItemTemplate>
<ItemTemplate>
<span style="">ModuleTitle:
<asp:Label ID="ModuleTitleLabel" runat="server" Text='<%# Eval("ModuleTitle") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
ModuleCode:
<asp:Label ID="ModuleCodeLabel" runat="server" Text='<%# Eval("ModuleCode") %>' />
<br />
ModuleMarks:
<asp:Label ID="ModuleMarksLabel" runat="server" Text='<%# Eval("ModuleMarks") %>' />
<br />
MarkID:
<asp:Label ID="MarkIDLabel" runat="server" Text='<%# Eval("MarkID") %>' />
<br />
ExamMark:
<asp:Label ID="ExamMarkLabel" runat="server" Text='<%# Eval("ExamMark") %>' />
<br />
AssignmentMark:
<asp:Label ID="AssignmentMarkLabel" runat="server" Text='<%# Eval("AssignmentMark") %>' />
<br />
SNumber:
<asp:Label ID="SNumberLabel" runat="server" Text='<%# Eval("SNumber") %>' />
<br />
Expr1:
<asp:Label ID="Expr1Label" runat="server" Text='<%# Eval("Expr1") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
<br />
</span>
</ItemTemplate>
<LayoutTemplate>
<div id="itemPlaceholderContainer" runat="server" style="">
<span runat="server" id="itemPlaceholder" />
</div>
<div style="">
</div>
</LayoutTemplate>
<SelectedItemTemplate>
<span style="">ModuleTitle:
<asp:Label ID="ModuleTitleLabel" runat="server" Text='<%# Eval("ModuleTitle") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
ModuleCode:
<asp:Label ID="ModuleCodeLabel" runat="server" Text='<%# Eval("ModuleCode") %>' />
<br />
ModuleMarks:
<asp:Label ID="ModuleMarksLabel" runat="server" Text='<%# Eval("ModuleMarks") %>' />
<br />
MarkID:
<asp:Label ID="MarkIDLabel" runat="server" Text='<%# Eval("MarkID") %>' />
<br />
ExamMark:
<asp:Label ID="ExamMarkLabel" runat="server" Text='<%# Eval("ExamMark") %>' />
<br />
AssignmentMark:
<asp:Label ID="AssignmentMarkLabel" runat="server" Text='<%# Eval("AssignmentMark") %>' />
<br />
SNumber:
<asp:Label ID="SNumberLabel" runat="server" Text='<%# Eval("SNumber") %>' />
<br />
Expr1:
<asp:Label ID="Expr1Label" runat="server" Text='<%# Eval("Expr1") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
<br />
</span>
</SelectedItemTemplate>
</asp:ListView>
Try changing it to a gridview which should allow the update to work. Try this code below:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="searchStudentResults" cssClass="table table-hover" AllowSorting="True" OnRowUpdated="GridView1_RowUpdated1" >
<Columns>
<asp:BoundField DataField="StudentNo" HeaderText="StudentNo" SortExpression="StudentNo" ReadOnly="true" />
<asp:BoundField DataField="ExamMark" HeaderText="Exam %" SortExpression="ExamMark" />
<asp:BoundField DataField="AssignmentMark" HeaderText="Assignment %" SortExpression="AssignmentMark" />
<asp:BoundField DataField="ModuleMarks" SortExpression="ModuleMarks" HeaderText="ModuleMarks" ReadOnly="true" DataFormatString="{0:0}" />
<asp:CommandField ShowEditButton="True" ButtonType="Button" EditText="Add Marks" ControlStyle-CssClass="btn btn-primary" ItemStyle-Width="100px" >
<ControlStyle CssClass="btn btn-primary"></ControlStyle>
<ItemStyle Width="100px"></ItemStyle>
</asp:CommandField>
<asp:BoundField DataField="MarkID" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" >
<ControlStyle CssClass="hidden"></ControlStyle>
<HeaderStyle CssClass="hidden"></HeaderStyle>
<ItemStyle CssClass="hidden"></ItemStyle>
</asp:BoundField>
</Columns>
<EmptyDataTemplate>
No marks to enter
</EmptyDataTemplate>
</asp:GridView>

CSS footer are going in place of right side

I have a problem with my footer as I divided the page as follow:
<%# Page Title="" Language="C#" MasterPageFile="~/SVM.Master" AutoEventWireup="true" CodeBehind="Cateshow.aspx.cs" Inherits="beravoSV.Cateshow" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.style8 {
color: #333333;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="midcont">
<div class="leftsidemainadsshow">
<br />
<asp:ListView ID="cateshowlistview" runat="server" DataSourceID="categoryshowsql" Style="text-align: left">
<ItemTemplate>
<div class="templist">
<asp:LinkButton ID="Adstitlinkbtn" runat="server"
Style="font-weight: 700; color: #0066FF" Text='<%# Eval("AdsTit") %>'
CssClass="adstit" OnClick="Adstitlinkbtn_Click"
PostBackUrl='<%# "AdsDetails.aspx?AdsTit=" + Eval("AdsID") %>'></asp:LinkButton>
<br />
<asp:ImageButton ID="ImageButton3" runat="server" Height="88px" Width="91px"
CssClass="imag1" ImageUrl='<%# "/images/AdsImgs/" + Eval("Img1") %>'
PostBackUrl='<%# "AdsDetails.aspx?Img1=" + Eval("AdsID") %>' />
<br />
<asp:Label ID="AdsDescLabel" runat="server" Text='<%# Eval("AdsDesc") %>'
CssClass="adsdisc" />
<br />
<br />
<br />
<br />
<asp:Label ID="Sectlbl" runat="server" Text='<%# Eval("Section") %>'
Style="color: #333333"></asp:Label>
-
<asp:Label ID="categlbl" runat="server" Text='<%# Eval("Category") %>'
Style="color: #333333; font-weight: 700; font-style: italic;"></asp:Label>
<br />
<asp:Label ID="CountryLabel" runat="server" Text='<%# Eval("Country") %>'
Style="color: #333333" />
-
<asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>'
Style="color: #333333" />
-
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'
Style="color: #333333" />
<div class="adsprice">
<span class="style8">Price:</span>
<asp:Label ID="AdsPriceLabel" runat="server" Style="color: #FF0000"
Text='<%# Eval("AdsPrice") %>' />
</div>
<div class="iconadsbox">
<asp:ImageButton ID="Likebtn" runat="server"
ImageUrl="~/iconsimg/favoritestar2.png" OnClick="Likebtn_Click" />
<asp:ImageButton ID="sendmailbtn" runat="server"
ImageUrl="~/iconsimg/mailposter.png" OnClick="sendmailbtn_Click" />
</div>
<asp:Image ID="Image1" runat="server" CssClass="divideline" />
<br />
</div>
</ItemTemplate>
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
<asp:DataPager ID="DataPager2" runat="server" PagedControlID="cateshowlistview" PageSize="7">
<Fields>
<asp:NumericPagerField />
<asp:NextPreviousPagerField />
</Fields>
</asp:DataPager>
</LayoutTemplate>
</asp:ListView>
</div>
<div class="primumads">
</div>
<br />
<br />
<asp:SqlDataSource ID="categoryshowsql" runat="server"
ConnectionString="<%$ ConnectionStrings:BeravaConnectionString %>"
SelectCommand="SELECT DISTINCT [AdsID],[Section], [Category], [Country], [State], [City], [AdsTit], SUBSTRING([AdsDesc],1,155) as AdsDesc, [AdsPrice], [Img1] FROM [ads] WHERE (([Category] = #Category) AND ([Country] = #Country))">
<SelectParameters>
<asp:QueryStringParameter Name="Category" QueryStringField="cat"
Type="String" />
<asp:SessionParameter Name="Country" SessionField="location" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</div>
<br />
</asp:Content>
When the rightside is empty the footer is going up and if it is full its will come down to the bottom. How I can make it always down even if the right side is empty?
You can find the below link to know more what is going up with me
enter link description here
You can add to te footer the following:
style="position: fixed; bottom: 0; width: 100% (This will fix the footer to the bottom of your screen)
If what is to fix the footer to the end of you page, you need to give to the header and to the content of your page a min height, here's an example:
<div id="header" style="min-height: 10%"></div>
<div id="content" style="min-height: 80%"></div>
<div id="footer" style="min-height: 10%"></div>
Note: you don't need to say that min-height: 10% in the footer, that's implicit.

ASP: Listview buttons do nothing

I have a listview control databound to a database in my ASP project and I have it set so that it can be edited. The listview is inside a multiview and it loads the information perfectly but clicking on the edit button doesn't do anything. The listview is in an update panel which I though might be part of it but putting the listview outside the update panel just causes the multivew to change view back the default page load view.
I have a perfectly functional editable listview in a previous project in almost identical circumstances and I just can't figure out what's made this one not work. I've tried deleting and remaking but this problem seems to be affecting any listview I make in the multiview. On other listviews where I've implemented the 'insert' feature, the insert button does not do anything either.
My code is below:
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:ListView ID="ListView2" runat="server" DataKeyNames="StudentID"
DataSourceID="SqlDataSource10" GroupItemCount="3">
<AlternatingItemTemplate>
<td runat="server" style="background-color: #FFFFFF;color: #284775;">
StudentID:
<asp:Label ID="StudentIDLabel" runat="server" Text='<%# Eval("StudentID") %>' />
<br />
CurrentSchoolID:
<asp:Label ID="CurrentSchoolIDLabel" runat="server"
Text='<%# Eval("CurrentSchoolID") %>' />
<br />
Gender:
<asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
<br />
Fname:
<asp:Label ID="FnameLabel" runat="server" Text='<%# Eval("Fname") %>' />
<br />
Lname:
<asp:Label ID="LnameLabel" runat="server" Text='<%# Eval("Lname") %>' />
<br />
ParentCarer:
<asp:Label ID="ParentCarerLabel" runat="server"
Text='<%# Eval("ParentCarer") %>' />
<br />
StAddress:
<asp:Label ID="StAddressLabel" runat="server" Text='<%# Eval("StAddress") %>' />
<br />
suburb:
<asp:Label ID="suburbLabel" runat="server" Text='<%# Eval("suburb") %>' />
<br />
postCode:
<asp:Label ID="postCodeLabel" runat="server" Text='<%# Eval("postCode") %>' />
<br />
DOB:
<asp:Label ID="DOBLabel" runat="server" Text='<%# Eval("DOB") %>' />
<br />
homePhone:
<asp:Label ID="homePhoneLabel" runat="server" Text='<%# Eval("homePhone") %>' />
<br />
MobilePhone:
<asp:Label ID="MobilePhoneLabel" runat="server"
Text='<%# Eval("MobilePhone") %>' />
<br />
WorkPhone:
<asp:Label ID="WorkPhoneLabel" runat="server" Text='<%# Eval("WorkPhone") %>' />
<br />
email:
<asp:Label ID="emailLabel" runat="server" Text='<%# Eval("email") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
Username:
<asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</AlternatingItemTemplate>
<EditItemTemplate>
<td runat="server" style="background-color: #999999;">
StudentID:
<asp:Label ID="StudentIDLabel1" runat="server"
Text='<%# Eval("StudentID") %>' />
<br />
CurrentSchoolID:
<asp:TextBox ID="CurrentSchoolIDTextBox" runat="server"
Text='<%# Bind("CurrentSchoolID") %>' />
<br />
Gender:
<asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
<br />
Fname:
<asp:TextBox ID="FnameTextBox" runat="server" Text='<%# Bind("Fname") %>' />
<br />
Lname:
<asp:TextBox ID="LnameTextBox" runat="server" Text='<%# Bind("Lname") %>' />
<br />
ParentCarer:
<asp:TextBox ID="ParentCarerTextBox" runat="server"
Text='<%# Bind("ParentCarer") %>' />
<br />
StAddress:
<asp:TextBox ID="StAddressTextBox" runat="server"
Text='<%# Bind("StAddress") %>' />
<br />
suburb:
<asp:TextBox ID="suburbTextBox" runat="server" Text='<%# Bind("suburb") %>' />
<br />
postCode:
<asp:TextBox ID="postCodeTextBox" runat="server"
Text='<%# Bind("postCode") %>' />
<br />
DOB:
<asp:TextBox ID="DOBTextBox" runat="server" Text='<%# Bind("DOB") %>' />
<br />
homePhone:
<asp:TextBox ID="homePhoneTextBox" runat="server"
Text='<%# Bind("homePhone") %>' />
<br />
MobilePhone:
<asp:TextBox ID="MobilePhoneTextBox" runat="server"
Text='<%# Bind("MobilePhone") %>' />
<br />
WorkPhone:
<asp:TextBox ID="WorkPhoneTextBox" runat="server"
Text='<%# Bind("WorkPhone") %>' />
<br />
email:
<asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' />
<br />
Username:
<asp:TextBox ID="UsernameTextBox" runat="server"
Text='<%# Bind("Username") %>' />
<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>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
<td>
No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<EmptyItemTemplate>
<td runat="server" />
</EmptyItemTemplate>
<GroupTemplate>
<tr ID="itemPlaceholderContainer" runat="server">
<td ID="itemPlaceholder" runat="server">
</td>
</tr>
</GroupTemplate>
<InsertItemTemplate>
<td runat="server" style="">
CurrentSchoolID:
<asp:TextBox ID="CurrentSchoolIDTextBox" runat="server"
Text='<%# Bind("CurrentSchoolID") %>' />
<br />
Gender:
<asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
<br />
Fname:
<asp:TextBox ID="FnameTextBox" runat="server" Text='<%# Bind("Fname") %>' />
<br />
Lname:
<asp:TextBox ID="LnameTextBox" runat="server" Text='<%# Bind("Lname") %>' />
<br />
ParentCarer:
<asp:TextBox ID="ParentCarerTextBox" runat="server"
Text='<%# Bind("ParentCarer") %>' />
<br />
StAddress:
<asp:TextBox ID="StAddressTextBox" runat="server"
Text='<%# Bind("StAddress") %>' />
<br />
suburb:
<asp:TextBox ID="suburbTextBox" runat="server" Text='<%# Bind("suburb") %>' />
<br />
postCode:
<asp:TextBox ID="postCodeTextBox" runat="server"
Text='<%# Bind("postCode") %>' />
<br />
DOB:
<asp:TextBox ID="DOBTextBox" runat="server" Text='<%# Bind("DOB") %>' />
<br />
homePhone:
<asp:TextBox ID="homePhoneTextBox" runat="server"
Text='<%# Bind("homePhone") %>' />
<br />
MobilePhone:
<asp:TextBox ID="MobilePhoneTextBox" runat="server"
Text='<%# Bind("MobilePhone") %>' />
<br />
WorkPhone:
<asp:TextBox ID="WorkPhoneTextBox" runat="server"
Text='<%# Bind("WorkPhone") %>' />
<br />
email:
<asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' />
<br />
Username:
<asp:TextBox ID="UsernameTextBox" runat="server"
Text='<%# Bind("Username") %>' />
<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>
<ItemTemplate>
<td runat="server" style="background-color: #E0FFFF;color: #333333;">
StudentID:
<asp:Label ID="StudentIDLabel" runat="server" Text='<%# Eval("StudentID") %>' />
<br />
CurrentSchoolID:
<asp:Label ID="CurrentSchoolIDLabel" runat="server"
Text='<%# Eval("CurrentSchoolID") %>' />
<br />
Gender:
<asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
<br />
Fname:
<asp:Label ID="FnameLabel" runat="server" Text='<%# Eval("Fname") %>' />
<br />
Lname:
<asp:Label ID="LnameLabel" runat="server" Text='<%# Eval("Lname") %>' />
<br />
ParentCarer:
<asp:Label ID="ParentCarerLabel" runat="server"
Text='<%# Eval("ParentCarer") %>' />
<br />
StAddress:
<asp:Label ID="StAddressLabel" runat="server" Text='<%# Eval("StAddress") %>' />
<br />
suburb:
<asp:Label ID="suburbLabel" runat="server" Text='<%# Eval("suburb") %>' />
<br />
postCode:
<asp:Label ID="postCodeLabel" runat="server" Text='<%# Eval("postCode") %>' />
<br />
DOB:
<asp:Label ID="DOBLabel" runat="server" Text='<%# Eval("DOB") %>' />
<br />
homePhone:
<asp:Label ID="homePhoneLabel" runat="server" Text='<%# Eval("homePhone") %>' />
<br />
MobilePhone:
<asp:Label ID="MobilePhoneLabel" runat="server"
Text='<%# Eval("MobilePhone") %>' />
<br />
WorkPhone:
<asp:Label ID="WorkPhoneLabel" runat="server" Text='<%# Eval("WorkPhone") %>' />
<br />
email:
<asp:Label ID="emailLabel" runat="server" Text='<%# Eval("email") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
Username:
<asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="groupPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr ID="groupPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<td runat="server"
style="background-color: #E2DED6;font-weight: bold;color: #333333;">
StudentID:
<asp:Label ID="StudentIDLabel" runat="server" Text='<%# Eval("StudentID") %>' />
<br />
CurrentSchoolID:
<asp:Label ID="CurrentSchoolIDLabel" runat="server"
Text='<%# Eval("CurrentSchoolID") %>' />
<br />
Gender:
<asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
<br />
Fname:
<asp:Label ID="FnameLabel" runat="server" Text='<%# Eval("Fname") %>' />
<br />
Lname:
<asp:Label ID="LnameLabel" runat="server" Text='<%# Eval("Lname") %>' />
<br />
ParentCarer:
<asp:Label ID="ParentCarerLabel" runat="server"
Text='<%# Eval("ParentCarer") %>' />
<br />
StAddress:
<asp:Label ID="StAddressLabel" runat="server" Text='<%# Eval("StAddress") %>' />
<br />
suburb:
<asp:Label ID="suburbLabel" runat="server" Text='<%# Eval("suburb") %>' />
<br />
postCode:
<asp:Label ID="postCodeLabel" runat="server" Text='<%# Eval("postCode") %>' />
<br />
DOB:
<asp:Label ID="DOBLabel" runat="server" Text='<%# Eval("DOB") %>' />
<br />
homePhone:
<asp:Label ID="homePhoneLabel" runat="server" Text='<%# Eval("homePhone") %>' />
<br />
MobilePhone:
<asp:Label ID="MobilePhoneLabel" runat="server"
Text='<%# Eval("MobilePhone") %>' />
<br />
WorkPhone:
<asp:Label ID="WorkPhoneLabel" runat="server" Text='<%# Eval("WorkPhone") %>' />
<br />
email:
<asp:Label ID="emailLabel" runat="server" Text='<%# Eval("email") %>' />
<br />
UserID:
<asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
<br />
Username:
<asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<br />
</td>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource10" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [Student] WHERE [StudentID] = #StudentID"
InsertCommand="INSERT INTO [Student] ([CurrentSchoolID], [Gender], [Fname], [Lname], [ParentCarer], [StAddress], [suburb], [postCode], [DOB], [homePhone], [MobilePhone], [WorkPhone], [email], [UserID], [Username]) VALUES (#CurrentSchoolID, #Gender, #Fname, #Lname, #ParentCarer, #StAddress, #suburb, #postCode, #DOB, #homePhone, #MobilePhone, #WorkPhone, #email, #UserID, #Username)"
SelectCommand="SELECT * FROM [Student] WHERE ([Username] = #Username)"
UpdateCommand="UPDATE [Student] SET [CurrentSchoolID] = #CurrentSchoolID, [Gender] = #Gender, [Fname] = #Fname, [Lname] = #Lname, [ParentCarer] = #ParentCarer, [StAddress] = #StAddress, [suburb] = #suburb, [postCode] = #postCode, [DOB] = #DOB, [homePhone] = #homePhone, [MobilePhone] = #MobilePhone, [WorkPhone] = #WorkPhone, [email] = #email, [UserID] = #UserID, [Username] = #Username WHERE [StudentID] = #StudentID">
<DeleteParameters>
<asp:Parameter Name="StudentID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="CurrentSchoolID" Type="Int32" />
<asp:Parameter Name="Gender" Type="String" />
<asp:Parameter Name="Fname" Type="String" />
<asp:Parameter Name="Lname" Type="String" />
<asp:Parameter Name="ParentCarer" Type="String" />
<asp:Parameter Name="StAddress" Type="String" />
<asp:Parameter Name="suburb" Type="String" />
<asp:Parameter Name="postCode" Type="Int32" />
<asp:Parameter DbType="Date" Name="DOB" />
<asp:Parameter Name="homePhone" Type="String" />
<asp:Parameter Name="MobilePhone" Type="String" />
<asp:Parameter Name="WorkPhone" Type="String" />
<asp:Parameter Name="email" Type="String" />
<asp:Parameter Name="UserID" Type="Int32" />
<asp:Parameter Name="Username" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:SessionParameter Name="Username" SessionField="Username" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="CurrentSchoolID" Type="Int32" />
<asp:Parameter Name="Gender" Type="String" />
<asp:Parameter Name="Fname" Type="String" />
<asp:Parameter Name="Lname" Type="String" />
<asp:Parameter Name="ParentCarer" Type="String" />
<asp:Parameter Name="StAddress" Type="String" />
<asp:Parameter Name="suburb" Type="String" />
<asp:Parameter Name="postCode" Type="Int32" />
<asp:Parameter DbType="Date" Name="DOB" />
<asp:Parameter Name="homePhone" Type="String" />
<asp:Parameter Name="MobilePhone" Type="String" />
<asp:Parameter Name="WorkPhone" Type="String" />
<asp:Parameter Name="email" Type="String" />
<asp:Parameter Name="UserID" Type="Int32" />
<asp:Parameter Name="Username" Type="String" />
<asp:Parameter Name="StudentID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
C# Code:
protected void Page_Load(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
if (!Page.IsPostBack)
{
if (User.IsInRole("Student"))
{
MultiView1.ActiveViewIndex = 2;
}
else if (User.IsInRole("Staff"))
{
MultiView1.ActiveViewIndex = 6;
}
else if (User.IsInRole("Admin"))
{
MultiView1.ActiveViewIndex = 7;
}
}
}
changed my code on page load to:
if(!User.Identity.IsAuthenticated){
MultiView1.ActiveViewIndex = 0;
}
Now works fine

How can i add a event handler to a customized button inside listview?

This is my markup
<%# Page Title="Daily Expenses" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Daily Expenses.aspx.cs" Inherits="Daily_Expenses" %>
function calendar_datechange() {
__doPostBack('txtCalendar', 'txtCalendar_TextChanged');
}
function Calculate_Difference() {
alert("Hello");
}
</script>
<asp:ToolkitScriptManager ID="AjaxScript" runat="server"></asp:ToolkitScriptManager>
<asp:TextBox ID="txtCalendar" runat="server"
ontextchanged="txtCalendar_TextChanged"></asp:TextBox>
<%--<asp:PopupControlExtender ID="txtCalendar_PopupControlExtender" runat="server"
DynamicServicePath="" Enabled="True" ExtenderControlID="" PopupControlID="Panel1"
TargetControlID="txtCalendar">
</asp:PopupControlExtender>
<asp:Panel ID="Panel1" runat="server">
<h2>Hello There</h2>
</asp:Panel>--%>
<asp:CalendarExtender ID="CalendarControl" runat="server" OnClientDateSelectionChanged="calendar_datechange" TargetControlID="txtCalendar" PopupButtonID="CalendarButton">
</asp:CalendarExtender>
<%--<ajaxToolkit:CalendarExtender ID="CalendarControl" runat="server" OnClientDateSelectionChanged="calendar_datechange" TargetControlID="txtCalendar" PopupButtonID="CalendarButton"></ajaxToolkit:CalendarExtender>--%>
<asp:Button ID="CalendarButton" runat="server" Text="Calendar" />
<br />
<br />
<br />
<asp:ListView ID="ListView1" runat="server" DataKeyNames="SNO"
DataSourceID="SqlDataSource1" InsertItemPosition="LastItem">
<AlternatingItemTemplate>
<li style="background-color: #FFF8DC;">SNO:
<asp:Label ID="SNOLabel" runat="server" Text='<%# Eval("SNO") %>' />
<br />
Taxinreal:
<asp:Label ID="TaxinrealLabel" runat="server" Text='<%# Eval("Taxinreal") %>' />
<br />
Taxinpercent:
<asp:Label ID="TaxinpercentLabel" runat="server"
Text='<%# Eval("Taxinpercent") %>' />
<br />
Amount:
<asp:Label ID="AmountLabel" runat="server" Text='<%# Eval("Amount") %>' />
<br />
NetAmount:
<asp:Label ID="NetAmountLabel" runat="server" Text='<%# Eval("NetAmount") %>' />
<br />
DateTakenPlace:
<asp:Label ID="DateTakenPlaceLabel" runat="server"
Text='<%# Eval("DateTakenPlace") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<asp:Button ID="Differencebutton" runat="server" Text="Calculate Difference" OnClientClick="Calculate_Difference" />
</li>
</AlternatingItemTemplate>
<EditItemTemplate>
<li style="background-color: #008A8C;color: #FFFFFF;">SNO:
<asp:Label ID="SNOLabel1" runat="server" Text='<%# Eval("SNO") %>' />
<br />
Taxinreal:
<asp:TextBox ID="TaxinrealTextBox" runat="server"
Text='<%# Bind("Taxinreal") %>' />
<br />
Taxinpercent:
<asp:TextBox ID="TaxinpercentTextBox" runat="server"
Text='<%# Bind("Taxinpercent") %>' />
<br />
Amount:
<asp:TextBox ID="AmountTextBox" runat="server" Text='<%# Bind("Amount") %>' />
<br />
NetAmount:
<asp:TextBox ID="NetAmountTextBox" runat="server"
Text='<%# Bind("NetAmount") %>' />
<br />
DateTakenPlace:
<asp:TextBox ID="DateTakenPlaceTextBox" runat="server"
Text='<%# Bind("DateTakenPlace") %>' />
<br />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
<asp:Button ID="Differencebutton" runat="server" CommandName="Difference" OnClientClick="Calculate_Difference" Text="Calculate Difference" />
</li>
</EditItemTemplate>
<EmptyDataTemplate>
No data was returned.
</EmptyDataTemplate>
<InsertItemTemplate>
<li style="">Taxinreal:
<asp:TextBox ID="TaxinrealTextBox" runat="server"
Text='<%# Bind("Taxinreal") %>' />
<br />
Taxinpercent:
<asp:TextBox ID="TaxinpercentTextBox" runat="server"
Text='<%# Bind("Taxinpercent") %>' />
<br />
Amount:
<asp:TextBox ID="AmountTextBox" runat="server" Text='<%# Bind("Amount") %>' />
<br />
NetAmount:
<asp:TextBox ID="NetAmountTextBox" runat="server"
Text='<%# Bind("NetAmount") %>' />
<br />
DateTakenPlace:
<asp:TextBox ID="DateTakenPlaceTextBox" runat="server"
Text='<%# Bind("DateTakenPlace") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
<asp:Button ID="Differencebutton" runat="server" CommandName="Difference" OnClientClick="Calculate_Difference" Text="Calculate Difference" />
</li>
</InsertItemTemplate>
<ItemSeparatorTemplate>
<br />
</ItemSeparatorTemplate>
<ItemTemplate>
<li style="background-color: #DCDCDC;color: #000000;">SNO:
<asp:Label ID="SNOLabel" runat="server" Text='<%# Eval("SNO") %>' />
<br />
Taxinreal:
<asp:Label ID="TaxinrealLabel" runat="server" Text='<%# Eval("Taxinreal") %>' />
<br />
Taxinpercent:
<asp:Label ID="TaxinpercentLabel" runat="server"
Text='<%# Eval("Taxinpercent") %>' />
<br />
Amount:
<asp:Label ID="AmountLabel" runat="server" Text='<%# Eval("Amount") %>' />
<br />
NetAmount:
<asp:Label ID="NetAmountLabel" runat="server" Text='<%# Eval("NetAmount") %>' />
<br />
DateTakenPlace:
<asp:Label ID="DateTakenPlaceLabel" runat="server"
Text='<%# Eval("DateTakenPlace") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<asp:Button ID="Differencebutton" runat="server" CommandName="Difference" OnClientClick="Calculate_Difference" Text="Calculate Difference" />
</li>
</ItemTemplate>
<LayoutTemplate>
<ul ID="itemPlaceholderContainer" runat="server"
style="font-family: Verdana, Arial, Helvetica, sans-serif;">
<li runat="server" id="itemPlaceholder" />
</ul>
<div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
<SelectedItemTemplate>
<li style="background-color: #008A8C;font-weight: bold;color: #FFFFFF;">SNO:
<asp:Label ID="SNOLabel" runat="server" Text='<%# Eval("SNO") %>' />
<br />
Taxinreal:
<asp:Label ID="TaxinrealLabel" runat="server" Text='<%# Eval("Taxinreal") %>' />
<br />
Taxinpercent:
<asp:Label ID="TaxinpercentLabel" runat="server"
Text='<%# Eval("Taxinpercent") %>' />
<br />
Amount:
<asp:Label ID="AmountLabel" runat="server" Text='<%# Eval("Amount") %>' />
<br />
NetAmount:
<asp:Label ID="NetAmountLabel" runat="server" Text='<%# Eval("NetAmount") %>' />
<br />
DateTakenPlace:
<asp:Label ID="DateTakenPlaceLabel" runat="server"
Text='<%# Eval("DateTakenPlace") %>' />
<br />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<asp:Button ID="Differencebutton" runat="server" CommandName="Difference" OnClientClick="Calculate_Difference" Text="Calculate Difference" />
</li>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnString %>"
DeleteCommand="DELETE FROM [tblexpenses] WHERE [SNO] = #SNO"
InsertCommand="INSERT INTO [tblexpenses] ([Taxinreal], [Taxinpercent], [Amount], [NetAmount], [DateTakenPlace]) VALUES (#Taxinreal, #Taxinpercent, #Amount, #NetAmount, #DateTakenPlace)"
SelectCommand="SELECT * FROM [tblexpenses] WHERE ([DateTakenPlace] = #DateTakenPlace2)"
UpdateCommand="UPDATE [tblexpenses] SET [Taxinreal] = #Taxinreal, [Taxinpercent] = #Taxinpercent, [Amount] = #Amount, [NetAmount] = #NetAmount, [DateTakenPlace] = #DateTakenPlace WHERE [SNO] = #SNO">
<DeleteParameters>
<asp:Parameter Name="SNO" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Taxinreal" Type="Double" />
<asp:Parameter Name="Taxinpercent" Type="Decimal" />
<asp:Parameter Name="Amount" Type="Double" />
<asp:Parameter Name="NetAmount" Type="Int32"/>
<asp:Parameter DbType="Date" Name="DateTakenPlace" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="txtCalendar" DbType="Date"
Name="DateTakenPlace2" PropertyName="Text" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Taxinreal" Type="Double" />
<asp:Parameter Name="Taxinpercent" Type="Decimal" />
<asp:Parameter Name="Amount" Type="Double" />
<asp:Parameter Name="NetAmount" Type="Int32" />
<asp:Parameter DbType="Date" Name="DateTakenPlace" />
<asp:Parameter Name="SNO" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<br />
<br />
<br />
<br />
<br />
I have a table tblexpense in my database. I have columns named Taxinreal , Taxinpercent,*Amount* NetAmount.*NetAmount* is computed column which is equal to*(Amount-Taxinreal-Taxinpercent)* Now what i want is at runtime in my aspx page the user must be able to insert amount,tax,taxinpercentage and according to the value supplied by user NetAmount must be calculated(Netamount=Amount-Tax-Taxpercentage) at runtime and inserted into the database.For this purpose i have a differencebutton which should perform the required mathematical operation. The problem i am having is i am using a listview. Now adding a new button is simple but how can i perform required mathematical operation in the click event of difference button so that when the listview is in update mode the user can change values of taxinreal ,taxinpercent and obtain the result at runtime and the result be updated in database ??? I need solution urgently(P.S. I need to use Listview only).
You want to use OnItemCommand of ListView.
Here is a sample.
You need to insert/update to database (using either ADO.Net, entity framework or linq-to-sql) in code behind if you want to perform calculation.

ASP.net Forms/DropDownList Help

I have created 2 dropdownlists that are binded to a SQL DB and then pulling up a GridView. But, more specifically is there a way to have 3 user picked boxes and then have a Gridview show up? I would like to have a quick efficient way to do this without problems. I created the first 2 DDLs with autopostback and not working properly. any suggestions?
<asp:Label ID="CustomerNumberLabel" runat="server" Text="Customer Number " Width="125px"></asp:Label>
<asp:DropDownList ID="CustomerNumber" runat="server" AutoPostBack="True"
DataSourceID="ADDRDataSource" DataTextField="SACSNO"
DataValueField="SACSNO" AppendDataBoundItems="True">
<asp:ListItem Text="Select a Customer" Value="" Selected="True" />
</asp:DropDownList><br />
<asp:SqlDataSource ID="ADDRDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:iSeriesHistoryConnectionString %>"
SelectCommand="SELECT [SACSNO] FROM [ADDR] WHERE ([SARP#1] = #column1)">
<SelectParameters>
<asp:SessionParameter Name="column1" SessionField="userName" Type="Decimal" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="ShipToNumberLabel" runat="server" Text="Ship-to Location " Width="125px"></asp:Label>
<asp:DropDownList ID="ShipToNumber" runat="server"
DataSourceID="ADDRShipToNumberDataSource" DataTextField="SASHNM"
DataValueField="SASHNM" AutoPostBack="True">
<asp:ListItem Text="Select Ship-To Location" Value="" Selected="True" />
</asp:DropDownList>
<asp:SqlDataSource ID="ADDRShipToNumberDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:iSeriesHistoryConnectionString %>"
SelectCommand="SELECT [SASHNM], [SASAD1], [SASAD2], [SASCTY], [SACSNO], [SASHST], [SASZIP] FROM [ADDR] WHERE ([SACSNO] = #SACSNO)">
<SelectParameters>
<asp:ControlParameter ControlID="CustomerNumber" Name="SACSNO"
PropertyName="SelectedValue" Type="Decimal" />
</SelectParameters>
</asp:SqlDataSource>
<br /><br />
<asp:FormView ID="FormView1" runat="server"
DataSourceID="ADDRShippingDataSource" Width="400px">
<EditItemTemplate>
SACSNO:
<asp:TextBox ID="SACSNOTextBox" runat="server" Text='<%# Bind("SACSNO") %>' />
<br />
SASHNM:
<asp:TextBox ID="SASHNMTextBox" runat="server" Text='<%# Bind("SASHNM") %>' />
<br />
SASAD1:
<asp:TextBox ID="SASAD1TextBox" runat="server" Text='<%# Bind("SASAD1") %>' />
<br />
SASAD2:
<asp:TextBox ID="SASAD2TextBox" runat="server" Text='<%# Bind("SASAD2") %>' />
<br />
SASCTY:
<asp:TextBox ID="SASCTYTextBox" runat="server" Text='<%# Bind("SASCTY") %>' />
<br />
SASHST:
<asp:TextBox ID="SASHSTTextBox" runat="server" Text='<%# Bind("SASHST") %>' />
<br />
SASZIP:
<asp:TextBox ID="SASZIPTextBox" runat="server" Text='<%# Bind("SASZIP") %>' />
<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>
SACSNO:
<asp:TextBox ID="SACSNOTextBox" runat="server" Text='<%# Bind("SACSNO") %>' />
<br />
SASHNM:
<asp:TextBox ID="SASHNMTextBox" runat="server" Text='<%# Bind("SASHNM") %>' />
<br />
SASAD1:
<asp:TextBox ID="SASAD1TextBox" runat="server" Text='<%# Bind("SASAD1") %>' />
<br />
SASAD2:
<asp:TextBox ID="SASAD2TextBox" runat="server" Text='<%# Bind("SASAD2") %>' />
<br />
SASCTY:
<asp:TextBox ID="SASCTYTextBox" runat="server" Text='<%# Bind("SASCTY") %>' />
<br />
SASHST:
<asp:TextBox ID="SASHSTTextBox" runat="server" Text='<%# Bind("SASHST") %>' />
<br />
SASZIP:
<asp:TextBox ID="SASZIPTextBox" runat="server" Text='<%# Bind("SASZIP") %>' />
<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>
Customer Detail<br />
<br />
<table class="style1" width="35px">
<tr>
<td class="style2" align="center" >
Address Line 1</td>
<td class="style3" align="center" >
<asp:Label ID="SASAD1Label" runat="server" Text='<%# Bind("SASAD1") %>' />
</td>
</tr>
<tr>
<td class="style2" align="center" >
Address Line 2</td>
<td class="style3" align="center" >
<asp:Label ID="SASAD2Label" runat="server" Text='<%# Bind("SASAD2") %>' />
</td>
</tr>
<tr>
<td class="style2" align="center">
City</td>
<td class="style3" align="center" >
<asp:Label ID="SASCTYLabel" runat="server" Text='<%# Bind("SASCTY") %>' />
</td>
</tr>
<tr>
<td align="center" class="style2">
State</td>
<td class="style3" align="center" >
<asp:Label ID="SASHSTLabel" runat="server" Text='<%# Bind("SASHST") %>' />
</td>
</tr>
<tr>
<td align="center" class="style2">
Zip</td>
<td class="style3" align="center" >
<asp:Label ID="SASZIPLabel" runat="server" Text='<%# Bind("SASZIP") %>' />
</td>
</tr>
</table>
<br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="ADDRShippingDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:iSeriesHistoryConnectionString %>"
SelectCommand="SELECT [SACSNO], [SASHNM], [SASAD1], [SASAD2], [SASCTY], [SASHST], [SASZIP] FROM [ADDR] WHERE ([SASHNM] = #SASHNM)">
<SelectParameters>
<asp:ControlParameter ControlID="ShipToNumber" Name="SASHNM"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
You can turn off AutoPostBack for all the DropDownLists, and add a Button called Lookup with something like the following in the Lookup Button_Click event:
ADDRShippingDataSource.SelectParameters.Clear()
If ShipToNumber.SelectedValue <> "" Then
ADDRShippingDataSource.SelectParameters.Add("SASHNM", ShipToNumber.SelectedValue)
End If
If CustomerNumber.SelectedValue <> "" Then
ADDRShippingDataSource.SelectParameters.Add("SACSNO", CustomerNumber.SelectedValue)
End If
ADDRShippingDataSource.DataBind()
Your select command would need to be updated to include the additional criteria in your DataSource:
SELECT [SACSNO], [SASHNM], [SASAD1], [SASAD2], [SASCTY], [SASHST], [SASZIP] FROM [ADDR] WHERE (#SASHNM IS NULL OR [SASHNM] = #SASHNM) OR (#SACSNO IS NULL OR [SACSNO] = #SACSNO)

Resources