aspx page object behind a MasterPage object page object? - c#

I have a drop down menu in my MasterPage file that drops down behind objects on the aspx page. I have used CSS to apply a z-index of 100 to the masterPage menu and a z-index of -1 to the tag in the aspx page. I have added position: relative; in the CSS for each. This is not working. It occurred to me that this might not even be possible to do? But surely others have a drop down menu in their masterPage file and it works correctly (doesn't get hidden by items in the page below). does anyone know if what I am trying to do is possible. and if so, does anyone have any ideas for what I might be doing incorrectly?
MasterPage code:
</head>
<body class="innermainbg">
<form id="Form1" runat="server">
<div>
<div class="header">
<div id="nav" class="clear hideSkiplink nav" >
<asp:Menu ID="NavigationMenu" runat="server" Orientation="Horizontal" CssClass="menu" >
<staticmenuitemstyle horizontalpadding="20"/>
<Items>
<asp:MenuItem Text="Search" NavigateUrl="~/Default.aspx" Value="Item1" >
<asp:MenuItem Text="Search By Age" NavigateUrl="~/SearchByAge.aspx" Value="Sub Item2"></asp:MenuItem>
<asp:MenuItem Text="Search By Price" NavigateUrl="~/SearchByPrice.aspx" Value="Sub Item3"></asp:MenuItem>
<asp:MenuItem Text="Search By Date" NavigateUrl="~/SearchByDate.aspx" Value="Sub Item2"></asp:MenuItem>
<asp:MenuItem Text="Search By Type" NavigateUrl="~/SearchByType.aspx" Value="Sub Item3"></asp:MenuItem>
<asp:MenuItem Text="Advanced Search" NavigateUrl="~/AdvSearch.aspx" Value="Sub Item1"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Get Listed Free!" NavigateUrl="~/GetListed.aspx" Value="Item2">
</asp:MenuItem>
<asp:MenuItem Text="Advertise" NavigateUrl="~/Advertise.aspx" Value="Item2">
<asp:MenuItem Text="Links" NavigateUrl="~/Links.aspx" Value="Sub Item1"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="About" NavigateUrl="~/About.aspx" Value="Item2">
<asp:MenuItem Text="Terms" NavigateUrl="~/Terms.aspx" Value="Sub Item1"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Contact" NavigateUrl="~/Contact.aspx" Value="Item2">
<asp:MenuItem Text="Help" NavigateUrl="~/Help.aspx" Value="Sub Item1"></asp:MenuItem>
<asp:MenuItem Text="FAQs" NavigateUrl="~/FAQs.aspx" Value="Sub Item2"></asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear"></div>
</div>
<div></div>
<div class="footerholder">
<div id="footerContent" class="footer">
© 2014 Professional Expressions Inc. ClassesnWorkshops.com is a registered Trademark of Professional Expressions Inc. All rights reserved.
</div>
</div>
</form>
</body>
</html>
parial CSS code:
.back
{
position: relative;
z-index: -1;
}
div.menu
{
padding: 0px 0px 0px 0px;
float: right;
width: 100%;
position: relative;
z-index: 100;
}
ClassResults.aspx page code:
<%# Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="ClassResults.aspx.cs" Inherits="ClassesnWorkshops.ClassResults" %>
ZipCode:
Distance:
lblSearchWords
<div align="left" style="background-color: transparent; height: 250px; float:left; width:100%; background-repeat:no-repeat; background-position: 50% 50%;">
<div style="width:13%; float:left; display:inline;" class="rtPad10px">
<asp:Image ID="spacer1" runat="server" ImageUrl="~/Images/spacer_130x18px.png" />
</div>
<div style="width:69%; height:100%; float:left; display:inline;">
<br />
<asp:Label ID="lblTotalItemCount" runat="server" Enabled="False"></asp:Label>
<asp:Label ID="lblCurrentPage" runat="server" Enabled="False"></asp:Label>
<asp:Label ID="lblSort" runat="server" Enabled="False" >Sort:</asp:Label>
<asp:DropDownList ID="ddlSort" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlSort_SelectedIndexChanged" ViewStateMode="Enabled" EnableViewState="true" >
<asp:ListItem Value="Title">Class Title</asp:ListItem>
<asp:ListItem Value="schoolName">School Name</asp:ListItem>
<asp:ListItem Value="ClassSubject">Subject</asp:ListItem>
<asp:ListItem Value="Miles">Distance</asp:ListItem>
<asp:ListItem Value="lowestCost">Cost (low to high)</asp:ListItem>
<asp:ListItem Value="dateStart">Start Date</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnSort" runat="server" Text="Sort" onclick="btnSort_Click" />
<asp:Label ID="lblItemsPerPage" runat="server" Enabled="False">Items per page:</asp:Label>
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
ViewStateMode="Enabled" EnableViewState="true" onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem Text="1" Selected="True" Value="1"></asp:ListItem>
<asp:ListItem Text="10" Value="10"></asp:ListItem>
<asp:ListItem Text="20" Value="20"></asp:ListItem>
<asp:ListItem Text="50" Value="50"></asp:ListItem>
<asp:ListItem Text="100" Value="100"></asp:ListItem>
<asp:ListItem Text="200" Value="200"></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<asp:Label ID="lblValidationZip" runat="server" Enabled="False" ForeColor="Red" Text="A valid 5 digit zipCode is required."></asp:Label><br />
<asp:Label ID="lblMessage" runat="server" Text="lblMessage"></asp:Label>
<br />
<asp:Label ID="lblMsgTooManyOrTooFew" runat="server" Text=""></asp:Label>
<br />
<asp:Repeater ID="rptClasses" runat="server" >
<ItemTemplate>
<asp:Table runat="server" ID="tblClassesReturned" style="width:99%" >
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell style="width:15%; text-align:left;">
<img src='C:\Users\Teresa\My Webs\ClassesnWorkshops\ClassesnWorkshops\images\logos\<%# DataBinder.Eval(Container.DataItem, "logoID") %>.jpg' align="left" alt="School Logo">
</asp:TableCell>
<asp:TableCell ID="TableCell1" runat="server" style="width:41%; float:left; text-align:left;">
Subject: <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassSubject")) %><br />
<b>Title: <asp:HyperLink ID="hlClass" NavigateUrl='<%#"~/Class.aspx?classID=" + DataBinder.Eval(Container.DataItem, "ClassID")%>' Text=<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassTitle")) %> Target="_blank" runat="server" /> </b><br></br>
<asp:Label ID="lblCostRange" ToolTip="Lowest price usually indicates residence, member or early bird cost. Highest price usually indicates non-residence, non-member or non-earlybird cost." runat="server">
Cost Range: <%# String.Format("{0:c}", DataBinder.Eval(Container.DataItem, "lowestCost")) %> - <%# String.Format("{0:c}", DataBinder.Eval(Container.DataItem, "highestCost")) %><br />
</asp:Label>
<asp:Label ID="lblCostNote" runat="server" font-size="8pt">
* Additional Fees or Discounts May Apply.
</asp:Label>
<br />
<asp:Label ID="lblClassSeason" ToolTip="Season that this class is held." runat="server">
<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassSeason")) %>
</asp:Label>
<asp:Label ID="lblClassYear" ToolTip="Year that this class is held" runat="server">
<%# String.Format("{0:0}", DataBinder.Eval(Container.DataItem, "ClassYear")) %>
</asp:Label>
<asp:Label ID="ClassDays" ToolTip="Days of the Week this class is held: M=Monday, T=Tuesday, W=Wednesday, H=Thursday, F=Friday, A=Saturday, S=Sunday" runat="server">
<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassDays")) %>
</asp:Label>
<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassStartTime")) %><br />
</asp:TableCell><asp:TableCell ID="TableCell2" runat="server" style="width:44%; float:left; text-align:left;">
<b><asp:HyperLink ID="HyperLink1" NavigateUrl="~/School.aspx" Text=<%# DataBinder.Eval(Container.DataItem, "schoolName") %> Target="_blank" runat="server" /> </b>
-
<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "Miles")) %> miles away
<br />
Campus: <%# DataBinder.Eval(Container.DataItem, "campus") %><br />
<%# DataBinder.Eval(Container.DataItem, "street") %>
<%# DataBinder.Eval(Container.DataItem, "city") %>,
<%# DataBinder.Eval(Container.DataItem, "state") %>
<%# DataBinder.Eval(Container.DataItem, "zip") %><br />
<asp:HyperLink ID="hlSchool" NavigateUrl=<%# DataBinder.Eval(Container.DataItem, "web") %> Text=<%# DataBinder.Eval(Container.DataItem, "web") %> Target="_blank" runat="server" /> <br>
<%-- %><br><%# DataBinder.Eval(Container.DataItem, "longDesc") --%>
</asp:TableCell></asp:TableRow></asp:Table><br /><hr>
<br />
</ItemTemplate>
</asp:Repeater>
<br />
<asp:LinkButton ID="LnkFirst" runat="server" onclick="LnkFirst_Click">First</asp:LinkButton> <asp:LinkButton ID="LnkPrevious" runat="server" onclick="LnkPrevious_Click">Previous</asp:LinkButton> <asp:Repeater ID="rptPages" runat="server">
<ItemTemplate>
<asp:LinkButton ID="btnPage" CommandName="Page" CommandArgument="<%# Container.DataItem %>" runat="server">
<%# Container.DataItem %>
</asp:LinkButton> </ItemTemplate></asp:Repeater> <asp:LinkButton ID="LnkNext" runat="server" onclick="LnkNext_Click">Next</asp:LinkButton> <asp:LinkButton ID="LnkLast" runat="server" onclick="LnkLast_Click">Last</asp:LinkButton><br />
<br />
<%--
<asp:Label ID="lblValidationZip" runat="server" Enabled="False" ForeColor="Red" Text="A valid 5 digit zipCode is required."></asp:Label><br />
<asp:Label ID="lblMessage" runat="server" Text="lblMessage"></asp:Label>
<br />
<asp:Label ID="lblMsgTooManyOrTooFew" runat="server" Text=""></asp:Label>
--%>
</div><div style="width:17%; float:left; display:inline;" ><asp:Image
ID="spacer2" runat="server" ImageUrl="~/Images/spacer_170x18px.png" /></div></div></asp:Content>

Check your css and html structure using inspect element tool of browser. Open site in browser, right click on it, on bottom of menu you will inspect element option.
This will give you view of complete html and your css. you can edit the css and it will give you instant change on your page.

Related

Filtering Gridview

when I filter the Gridview I lose the Footable function.
Strange behavior, if I click on the filter button, filter by brand and select the Pireli option, then click the update button.
I lose the Footable function, but if I then click the Update button again leaving the filter as Pireli the Footable function returns!!!!!
Seeing is believing if you navigate to the following url www.tyrescanner.net
Enter registration WR08SZE
Enter postcode KA227PR
Sorry for the jumping around here.
If you click on the filer Brand option and select Pireli, the Gridview will lose the Footable function, but if you click again on the Update button the Footable function returns!!!!!!!!
<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
<%--Resizing Gridview--%>
<script>
$(function () {
AttachjQueryFootableToTable();
});
function AttachjQueryFootableToTable() {
$('[id*=GridView1]').footable();
}
</script>
<script>
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
AttachjQueryFootableToTable();
});
</script>
<div class="row">
<div class="col-md-8 col-md-pull-0 ">
<asp:Label ID="lblRegText" runat="server" Text="Tyre Size: " Style="font-weight: 700; font-size: x-large" Visible="True"></asp:Label>
<asp:Label ID="lbltyresize" runat="server" Style="font-weight: 700; font-size: x-large" Visible="True"></asp:Label>
<a href="http://tyrescanner.net/pages/edit-tyre-size.aspx">
<asp:Label ID="lblEdit" runat="server" Text=" Edit" Style="font-size: large" Visible="True"></asp:Label>
</a>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-4 col-md-4">
<div class="container">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo"><span class="glyphicon glyphicon-filter">Filter</span></button>
<div id="demo" class="collapse">
<div class="row">
<div class="col-md-2 col-sm-2" style="width: 130px">
<h5><strong>Brand</strong></h5>
<asp:DropDownList ID="SRDDLBrand" runat="server" DataSourceID="SqlDataSourceBrand" DataTextField="TyreBrands" DataValueField="TyreBrands" Height="35px" Width="105px" AppendDataBoundItems="True">
<asp:ListItem Text="Select All" Value=" " />
</asp:DropDownList>
</div>
<div class="col-md-2 col-sm-2" style="width: 130px">
<h5><strong>Season</strong></h5>
<asp:DropDownList ID="SRDDLTyreType" runat="server" DataSourceID="SqlDataSourceTyreType" DataTextField="TyreType" DataValueField="TyreType" Height="35px" Width="105px" AppendDataBoundItems="True">
<asp:ListItem Text="Select All" Value=" " />
</asp:DropDownList>
</div>
<div class="col-md-2 col-sm-2" style="width: 130px">
<h5><strong>Fuel Efficiency</strong></h5>
<asp:DropDownList ID="SRDDLFuelCat" runat="server" DataSourceID="SqlDataSourceFuelCategory" DataTextField="TyreCategory" DataValueField="TyreCategory" Height="35px" Width="105px" AppendDataBoundItems="True">
<asp:ListItem Text="Select All" Value=" " />
</asp:DropDownList>
</div>
<div class="col-md-2 col-sm-2" style="width: 130px">
<h5><strong>Wet Grip</strong></h5>
<asp:DropDownList ID="SRDDLWetGrip" runat="server" DataSourceID="SqlDataSourceWetGrip" DataTextField="TyreCategory" DataValueField="TyreCategory" Height="35px" Width="105px" AppendDataBoundItems="True">
<asp:ListItem Text="Select All" Value=" " />
</asp:DropDownList>
</div>
<br />
<p></p>
<div class="col-md-2 col-sm-2">
<asp:Button ID="bntFilter" runat="server" OnClick="bntFIlter_Click" Text="Update Results" CssClass="btn Jumbt btn-custom" Style="color: white" role="button" Height="44px" />
</div>
</div>
</div>
</div>
</div>
</div>
<br />
<asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:GridView ID="GridView1" CssClass="footable" runat="server" AutoGenerateColumns="False" Style="max-width: 130%" AutoPostback="Flash" DataKeyNames="ProductID,GarageID" DataSourceID="SqlDataSourceGridViewSearchResults"
EmptyDataText="Sorry we don’t have that tyre, please email us your requirements and we will add it to our Search engine – service#tyrescanner.net"
OnSelectedIndexChanging="GridView1_SelectedIndexChanging" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" OnRowCreated="GridView1_RowCreated">
<Columns>
<%-- 0--%>
<asp:BoundField DataField="ProductID" HeaderText="ProductID" Visible="false" />
<%--1--%>
<asp:BoundField DataField="GarageID" HeaderText="GarageID" Visible="false" />
<%-- 2--%>
<asp:BoundField DataField="GarageTown" HeaderText="Garage Location"></asp:BoundField>
<%-- 3--%>
<asp:TemplateField HeaderText="Tyre Model">
<ItemTemplate>
<asp:Label ID="lblBrand" runat="server" Text='<%#Eval("Brand")+ " " + Eval("TyreModel")%>'></asp:Label>
<br />
<asp:Label ID="Label1" runat="server" Text="£" Height="16px" Width="4px" Font-Bold="True"></asp:Label>
<asp:Label ID="lblCurrency" runat="server" Font-Bold="True" Text='<%#Eval("ProductUnitSalePrice")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%-- 4--%>
<asp:BoundField DataField="TyreType" HeaderText="Tyre Type" />
<%-- 5 --%>
<asp:TemplateField HeaderText="Noise Level">
<ItemTemplate>
<asp:Label ID="lblNoiseEmission" runat="server" Text='<%#Eval("NoiseEmission")+ "dB"%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FuelEfficiencyCategory" HeaderText="Fuel Efficiency" />
<%-- 6 --%>
<asp:BoundField DataField="WetGrip" HeaderText="Wet Grip" />
<%-- 7 --%>
<asp:TemplateField HeaderText="Select Quantity">
<ItemTemplate>
<asp:DropDownList ID="txtQuantity" runat="server" OnSelectedIndexChanged="txtQuantity_SelectedIndexChanged"
AutoPostBack="true" Width="55px" Height="32px" DataFormatString="{0:£ 0.0}" ForeColor="Black">
<asp:ListItem Text="0" Value=" " />
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Errorlabel" runat="server" Text=""></asp:Label><p></p>
<asp:Label ID="LabelTotalPoundSign" runat="server" Font-Bold="true" Text="Total £" Height="16px" Width="4px"></asp:Label>
<asp:Label ID="lblTotal" runat="server" Font-Bold="true" Text="0.00" Width="30px"></asp:Label>
<asp:LinkButton runat="server" OnClick="btnOrder_Click" CommandName="Select" class="btn btn-custom btn-sm" Style="color: white">Order »</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>

Error on Jquery on webpage

In my webpage I have two controls that are bind to jquery.
One is a button to copy the Textbox value to clipboard and other is textbox to enter date.
But the problem is when I debug this web application, it throws the jquery error.
And when I comment out one javascript method and debug, it works (tried with both javascript method).
But when I dont't comment out, it doesn't work.
Aspx code:
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="searchSerialResult.aspx.cs" Inherits="Locker.searchSerialResult" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.auto-style3 {
color: #CC3300;
font-size: x-large;
}
.auto-style1 {
color: #FFFFFF;
font-size: large;
}
.auto-style2 {
color: #000000;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<p>
<p>
<p>
<strong> <span class="auto-style3"> Recorded Information</span><span class="auto-style1"> </span></strong>
<div style="width:70%; margin: auto auto; text-align:left; ">
<asp:Panel ID="Panel1" runat="server" BorderStyle="None">
<asp:Label ID="Label4" runat="server" CssClass="auto-style2" style="font-weight: 700; font-size: large" Text="Details for :"></asp:Label>
<asp:Label ID="Label5" runat="server" style="font-weight: 700; font-size: large; color: #0000FF"></asp:Label>
<br />
<br />
<asp:Label ID="Label1" runat="server" CssClass="auto-style2" Font-Bold="False" style="font-weight: 700; font-size: large" Text="Serial :"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" BorderStyle="Solid" Enabled="False" Font-Size="Medium" ForeColor="Black" Width="213px"></asp:TextBox>
<asp:Button ID="Button3" runat="server" Text="Copy Me!"/>
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script src="Scripts/jquery.zclip.js" type="text/javascript"></script>
<script src="Scripts/jquery.zclip.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#<%=Button3.ClientID%>').zclip({
path: 'ZeroClipboard.swf',
copy: function () { return $('#<%=TextBox2.ClientID%>').val(); }
});
});
</script>
<br />
<br />
<asp:Label ID="Label13" runat="server" CssClass="auto-style2" Font-Bold="False" style="font-weight: 700; font-size: large" Text="Serial Type :"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Height="26px" Width="181px" AutoPostBack="True" Enabled="False" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>Never Expire</asp:ListItem>
<asp:ListItem>Expire</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label14" runat="server" CssClass="auto-style2" Font-Bold="False" style="font-weight: 700; font-size: large" Text="Expiry Date :" Visible="False"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server" BorderStyle="Solid" Enabled="False" Height="16px" Visible="False" Width="136px"></asp:TextBox>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function () {
$("#<%=TextBox6.ClientID%>").datepicker({
});
});
</script> <br />
<br />
<asp:Label ID="Label6" runat="server" style="font-weight: 700; font-size: large" Text="Description :" CssClass="auto-style2"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server" BorderStyle="Solid" Font-Size="Medium" Height="48px" TextMode="MultiLine" Width="217px" Enabled="False"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label7" runat="server" style="font-weight: 700; font-size: small" Text="Last Editor was " CssClass="auto-style2"></asp:Label>
<asp:Label ID="Label8" runat="server" style="font-weight: 700; font-size: small" CssClass="auto-style2"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Edit" Width="97px" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Update" Visible="False" Width="97px" />
<br />
<br />
<asp:Label ID="Label12" runat="server" style="font-weight: 700; font-size: large; color: #0000FF" Visible="False"></asp:Label>
<br />
<br />
</asp:Panel>
</div>
</asp:Content
Works if i comment out anyone of the javascript method..
You're including more than one version of jQuery, and the second version overwrites the first version.
Therefore any plugins associated with the first version are removed. (ZClip in this case)
That´s right. You can´t use the same jquery plugin library (zclip) twice in order to append it to the $ sign. If you really need both (source and minified) you should use a different variable name for one of them. Otherwise it would cause conflicts.
So, I rather you to use this code:
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script src="Scripts/jquery.zclip.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%=Button3.ClientID%>').zclip({
path: 'ZeroClipboard.swf',
copy: function () { return $('#<%=TextBox2.ClientID%>').val(); }
});
});
</script>
If you are on production environment. If you are on development environment, then you should use the uncompressed version file of the jQuery plugin.

Using OnClientClick and onClick Shouldn't Refresh the Page

I'm trying to use onclientclick with onclick. The problem is that the page refreshes before any javascript code is run. I'm trying to integrate my javascript code into someone else's code. I know there's a lot of bad coding practices on his code, but I'm required to work with it. If you want me to isolate the code more, I can do that also. I've tried removing onclick and onclientclick. The page still refreshes.
aspx file
Online Checks
<center>
<h2>
Alvey Quality Monitoring Scheme</h2></center>
<div>
<h3>
Every 1/2 hour, check a unit from each line for the following:
Line 1 Global ID
Line 2 Global ID
Lines Running </h3>
<h3>
<asp:DropDownList ID="DropdownList1" runat="server" Height="20px" Width="85px" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="intSKU" DataValueField="strSpec" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Text="Select" Value="0" />
</asp:DropDownList><asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="63px" ReadOnly="True"></asp:TextBox><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Nestle1ConnectionString2 %>"
SelectCommand="SELECT [intSKU], [strSpec] FROM [lkpSKUInfo] ORDER BY [intSKU]"></asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="DropdownList1"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="DropdownList2"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="DropDownList3"></asp:RequiredFieldValidator>
<asp:DropDownList ID="DropdownList2" runat="server"
Height="20px" Width="85px" AutoPostBack="True" DataSourceID="SqlDataSource1" AppendDataBoundItems="true" DataTextField="intSKU" DataValueField="strSpec" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
<asp:ListItem Text="Select" Value="0" />
</asp:DropDownList><asp:TextBox ID="TextBox2" runat="server" Height="20px" Width="63px" ReadOnly="True"></asp:TextBox>
Line 1
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged1" Checked="True" />
Line 2 <asp:CheckBox ID="CheckBox2" runat="server" OnCheckedChanged="CheckBox2_CheckedChanged" AutoPostBack="True" Checked="True" />
</h3>
<h3>
<asp:Label ID="Label1" runat="server" Height="28px" Text="Line 1 Label View " Width="148px"></asp:Label>
<asp:Label ID="Label2" runat="server" Height="28px" Text="Line 2 Label View" Width="148px"></asp:Label></h3>
<p>
<asp:Image ID="Image1" runat="server" Height="155px" Width="670px" />
<asp:Image ID="Image2" runat="server" Height="155px" Width="670px" /></p>
<h3>
<asp:Label ID="Label3" runat="server" Height="28px" Text="Line 1 Print Apply View"
Width="219px"></asp:Label>
<asp:Label ID="Label4" runat="server" Height="28px" Text="Line 2 Print Apply View"
Width="207px"></asp:Label> </h3>
<h3>
<asp:Image ID="Image3" runat="server" Height="155px" Width="670px" />
<asp:Image ID="Image4" runat="server" Height="155px" Width="670px" />
</h3>
<h3>
<asp:Label ID="Label6" runat="server" Height="17px" Text="CASE CODE: " Width="133px"></asp:Label>
<asp:Label ID="Label9" runat="server" Height="17px" Text="Line 1"
Width="108px"></asp:Label>
<asp:Label ID="Label10" runat="server" Height="17px" Text="Line 2"
Width="108px"></asp:Label></h3>
<h3>
<asp:Label ID="Label5" runat="server" Height="39px" Text="Case code must match the line and hour from the can code"
Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox3" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox3_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox4" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox4_CheckedChanged" Checked="True" /></h3>
<h3>
<asp:Label ID="Label7" runat="server" Height="17px" Text="SHRINK FILM" Width="122px"></asp:Label> </h3>
<h3>
<asp:Label ID="Label8" runat="server" Height="39px" Text="Shrink Film must be intact, tightly covering the entire case, and have bullseyes that are tight and will not allow a can to fall out" Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox5" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox5_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox6" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox6_CheckedChanged" Checked="True" /></h3>
<h3>
<asp:Label ID="Label11" runat="server" Height="17px" Text="LABELS"
Width="122px"></asp:Label> </h3>
<h3>
<asp:Label ID="Label12" runat="server" Height="39px" Text="Labels must be correct for SKU scheduled to be produced, be applied correctly to the cans with no loose, crooked or upside-down labels" Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox7" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox7_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox8" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox8_CheckedChanged" Checked="True" /></h3>
<h3>
<asp:Label ID="Label13" runat="server" Height="17px" Text="TRAYS"
Width="122px"></asp:Label></h3>
<h3>
<asp:Label ID="Label14" runat="server" Height="39px" Text="Trays must match product produced, no double case, no loose flaps and no damaged cases" Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox9" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox9_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox10" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox10_CheckedChanged" Checked="True" /></h3>
<h3>
<asp:Label ID="Label15" runat="server" Height="17px" Text="PRINT & APPLY"
Width="166px"></asp:Label></h3>
<h3>
<asp:Label ID="Label16" runat="server" Height="39px" Text="Print & Apply stickers must match SKU produced, Julian Date, Best Before Date, Line and Time. Must be legible and applied correctly to the case. Stickers must match DIS ticket (except Australia)" Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox11" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox11_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox12" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox12_CheckedChanged" Checked="True" /></h3>
<h3>
<asp:Label ID="Label17" runat="server" Height="17px" Text="DIS TAG"
Width="166px"></asp:Label></h3>
<h3>
<asp:Label ID="Label18" runat="server" Height="39px" Text="Tags must match schedule and product produced" Width="904px"></asp:Label>
<asp:CheckBox ID="CheckBox13" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox13_CheckedChanged" Checked="True" />
<asp:CheckBox ID="CheckBox14" runat="server" Text="OK/Defective" OnCheckedChanged="CheckBox14_CheckedChanged" Checked="True" /></h3><br />
<h3>
Comments:
Operator Number
<asp:DropDownList ID="DropDownList3" runat="server" AppendDataBoundItems="true" Height="20px" Width="72px" DataSourceID="SqlDataSource2" DataTextField="intOperatorNumber" DataValueField="strLast">
<asp:ListItem Text="Select" Value="No Operator Selected" />
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Nestle1ConnectionString2 %>"
SelectCommand="SELECT [intOperatorNumber], [strLast] FROM [tblOperators] ORDER BY [intOperatorNumber]">
</asp:SqlDataSource>
Shift <asp:Label ID="Label" runat="server" Height="20px" Width="53px"></asp:Label>
</h3>
</div>
<asp:TextBox ID="TextBox3" runat="server" Height="81px" Width="381px"></asp:TextBox>
<asp:Label ID="lbl" runat="server" Height="20px" Width="80" BorderWidth="0px" Font-Names="Verdana"></asp:Label>
<input type="text" id="clock" style="border: 0px; width: 80px; height: 20px;" value="" readonly="readonly" />
Specific part of code not working
<!-- the button I'm clicking-->
<asp:Button ID="Button3" Font-Size="15" runat="server" Text="Send Data" Height="40px" Width="245px" OnClientClick="delayer();return false;" OnClick="Button3_Click" />
<asp:Button ID="Button4" Font-Size="15" runat="server" Text="Back" Height="40px" Width="245px" OnClick="Button4_Click" />
</form>
<script type="text/javascript">
</script>
<script type="text/javascript">
/*
var executionTime;
var initialTime = localStorage.getItem("initialTime");
function foo()
{
if(!(initialTime === null)){
executiontime = 5000-(new Date()).getTime() - parseInt(initialTime, 10);
if (executionTime<0) executionTime = 0;
showPopUp(executionTime);
}
}
*/
function showPopUp( var executionTime){
/* if(initialTime=== null)
{
executionTime = 5000;
}
localStorage.setItem("initialTime", (new Date()).getTime());
setTimeout(function() {alert("Warning");
localStorage.setItem("initialTime", null);}, executionTime);
*/
alert("warning");
}
function delayer(){
showPopUp();
}
// constants to define the title of the alert and button text.
var ALERT_TITLE = "Oops!";
var ALERT_BUTTON_TEXT = "Ok";
// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts
if(document.getElementById) {
window.alert = function(txt) {
createCustomAlert(txt); //overrides alert method
}
}
function createCustomAlert(txt) {
// shortcut reference to the document object
d = document;
// if the modalContainer object already exists in the DOM, bail out.
if(d.getElementById("modalContainer")) return;
// create the modalContainer div as a child of the BODY element
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
// make sure its as tall as it needs to be to overlay all the content on the page
mObj.style.height = document.documentElement.scrollHeight + "px";
// create the DIV that will be the alert
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
if(false) alertObj.style.top = document.documentElement.scrollTop + "px";
// center the alert box
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
// create an H1 element as the title bar
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
// create a paragraph element to contain the txt argument
msg = alertObj.appendChild(d.createElement("p"));
msg.innerHTML = txt;
// create an anchor element to use as the confirmation button.
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
// set up the onclick event to remove the alert when the anchor is clicked
btn.onclick = function() { removeCustomAlert();return false; }
}
// removes the custom alert from the DOM
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
</script>
</body>
</html>
You need to return false from delayer function, and also add return to OnClientClick event.
<asp:Button ID="Button3" runat="server" Text="Send Data"
OnClientClick="return delayer();" OnClick="Button3_Click" />
function delayer(){
showPopUp();
return false;
}

RadListView automatically sorting on ID column

I am using the Telerik radlistview o display some results, i perform some grouping in my query and return a sorted and ordered resultset and set it to the datasource. For some reason (which i have been battling with all morning) the ListView re-orders the results by the ID column.
<telerik:RadListView runat="server" ID="rlThumbnailView" OnNeedDataSource="rlThumbnailView_NeedDataSource"
AllowPaging="true" PageSize="8" OnDataBound="rlThumbnailView_DataBound" OnItemDataBound="rlThumbnailView_ItemDataBound">
<LayoutTemplate>
<span style="vertical-align: top; position: relative; top: 4px">Displaying page
<%#Container.CurrentPageIndex + 1 %>
of
<%#Container.PageCount %></span> </span>
<br />
<div id="list">
<asp:Panel runat="server" ID="Panel1" Style="float: left; margin-left: 160px" Visible="<%#Container.PageCount > 1 %>">
<asp:Button runat="server" ID="PrevButton" CommandName="Page" CommandArgument="Prev"
Text="Prev Page" Enabled="<%#Container.CurrentPageIndex > 0 %>" />
<asp:Button runat="server" ID="NextButton" CommandName="Page" CommandArgument="Next"
Text="Next Page" Enabled="<%#Container.CurrentPageIndex < Container.PageCount - 1 %>" />
</asp:Panel>
<div>
<telerik:RadSlider runat="server" ID="RadSlider1" MaximumValue="3" MinimumValue="1"
Value="2" LiveDrag="false" SmallChange="1" AutoPostBack="true" OnValueChanged="RadSlider1_ValueChanged"
Width="150px" CausesValidation="false" />
</div>
<div style="clear: both;">
</div>
<asp:Panel ID="itemPlaceholder" runat="server">
</asp:Panel>
<div style="clear: both;">
</div>
</div>
</LayoutTemplate>
<ItemTemplate>
<div id="wrapper" runat="server" style="float: left; margin-top: 2px; margin-bottom: 2px;">
<telerik:RadBinaryImage ID="ThumnailImage1" runat="server" />
UPC:
<asp:Label ID="lblUPC" runat="server"></asp:Label><br />
Description:
<asp:Label ID="lblDescription" runat="server"></asp:Label>
<br />
<div id="dvCountries" runat="server">
Languages:</div>
Changes:<asp:Label ID="lblChanges" runat="server"></asp:Label>
<br />
Pack Format:<asp:Label ID="lblPackType" runat="server"></asp:Label>
<br />
Date Completed:<asp:Label ID="lblDateCompleted" runat="server"></asp:Label>
<br />
</div>
</div>
</ItemTemplate>
</telerik:RadListView>
I beleive this is based on the standard microsoft listview,
For anybody who faces the same issue, the answer appears here:
http://www.telerik.com/community/forums/aspnet-ajax/listview/listview-paging-and-sortorder.aspx
seems to be a bug with Telerik

how do i reference a listview control that is nested in the itemtemplate of another listview control?

I have a listview control that is nested in the item template of another listview control that i'm trying to reference in codebehind using the .FindControl() method, but it keeps returning null. After get this to work, I'll need to reference a ComboBox inside of the inner listview. Here is where I am so far:
ListView lsvTickets
ItemTemplate
Listview lsvActions
ItemTemplate
ComboBox cboAssignees
I'm using the following code to attempt the reference in code behind:
var actions = (RadListView)lsvTickets.FindControl("lsvActions");
But this is returning null. I thought I would only have to do something like this to achieve the final desired result:
var assignees = (RadComboBox)lsvTickets.FindControl("lsvActions").FindControl("cboAssignees")
Can anyone help? What am I doing wrong here? Here's the full layout for those of you it would help:
<rad:RadListView runat="server" ID="lsvTickets">
<ItemTemplate>
<div id="divContainer" class="divContainer">
<div id="divTicketHeader" class="divTicketHeader">
<asp:Table runat="server" ID="tblTicketHead" Width="100%" CellSpacing="0" CellPadding="5" HorizontalAlign="Center">
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell Width="25%">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Subject") %>' Font-Bold="true" />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Status.Key") %>' />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label3" runat="server" Text='<%#Eval("Ticket.Reported_By") %>' />
</asp:TableCell><asp:TableCell Width="25%">
<asp:Label ID="Label4" runat="server" Text='<%#Eval("DateOpened") %>' />
</asp:TableCell></asp:TableRow></asp:Table></div>
<div id="divTicketBody" class="divComments">
<rad:RadListView runat="server" ID="lsvActions" DataSource='<%#Eval("TicketActions") %>'>
<ItemTemplate>
<center>
<div id="divAddComment" style="width: 500px;">
<div id="divCommentControls" style="margin: 8px 0px 8px 0px;">
<rad:RadComboBox runat="server" ID="cboStatus" DataSource='<%#GetStatuses() %>' DataTextField="Status" DataValueField="ID" /> <rad:RadComboBox runat="server" ID="cboAssignTo" DataSource='<%#GetAssignees() %>' DataTextField="Key" DataValueField="Value" />
</div>
<rad:RadTextBox runat="server" ID="txtComment" TextMode="MultiLine" Width="500" Height="100" CssClass="commentBox" /><br />
<div style="height: 35px;">
<div style="float:left"><asp:CheckBox ID="cbMakeITTicket" runat="server" Text="Convert to IT Support Ticket" /></div>
<div style="float:right; margin: 3px 0 0 0; "><rad:RadButton runat="server" ID="btnSubmit" Text="Submit" CssClass="buttonTag" /></div>
</div>
</div>
</center>
<div id="divComment" class="divComment">
<asp:Table runat="server" ID="tblComment" CellPadding="5">
<asp:TableRow>
<asp:TableCell Width="15%" HorizontalAlign="Center">
<rad:RadBinaryImage runat="server" ID="imgCommenter" Width="50" Height="50" /><br />
<asp:Label ID="Label5" runat="server" Text="[action author]" CssClass="commenterText" /><br />
<asp:Label ID="Label6" runat="server" Text='<%#Eval("Action_Date", "{0:MMM d, yyy hh:mm}") %>'
CssClass="commenterText"/><br />
</asp:TableCell><asp:TableCell>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("Description") %>' />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ItemTemplate>
</rad:RadListView>
</div>
</div>
</ItemTemplate>
</rad:RadListView>
</asp:Content>
You're looking for a combobox in a control that potentially has many lines (thus rows of combobox instances ) - it doesn’t know which one you’re looking for.
Obviously I don’t know what you need to do to the combobox but you should look at
alternate approaches.
Take a look at using the OnItemDataBound event of lsvActions
Then add code such as …
protected void lsvActions_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
RadComboBox myCBO = (RadComboBox)item.FindControl("cboStatus")
myCBO.Visible = false;
}
}
...also, just a general tip, I usually find using OnNeedDataSource to load RadGrids and ListViews saves a lot of headaches.
Hope that helps.

Categories