Friday, March 16, 2012

Passing a variable with two names in a hyperlink

I have the following code:


<asp:BoundColumn DataField="StoreID" HeaderText="Store ID"
DataFormatString="<a targer=_blank href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0}</a>"
SortExpression="StoreID desc" >


If the data is State Road, then it only passes State and not the entire State Road when clicking on the link. Any ideas?Call a method to check. If State, return one, otherwise, return two.
State was just an example...there could be any number of combinations of cities with two names on the results.

UrlEncode() it

I must be doing something wrong, because when I try the following code:
DataFormatString="UrlEncode(href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0})"

UrlEncode(href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID=WI RAPIDS>WI RAPIDS)
what am I doing wrong?

Any ideas on this one?


URLEncode is a keyword function, which means if you " (quote) it, your adding that specifically to your string, instead of performing the encode.

DataFormatString=UrlEncode("href=http://www...")


DataFormatString=UrlEncode("{0:0">http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0}")

produces the following error

Server Error in '/' Application.

Parser Error

Description:An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message:System.Web.UI.WebControls.DataGridColumnCollection must have items of type 'System.Web.UI.WebControls.DataGridColumn'. 'ItemStyle' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.
Source Error:

Line 580: DataFormatString=UrlEncode("http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0}"Line 581: SortExpression="StoreID desc" >Line 582: <ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />Line 583: </asp:BoundColumn>Line 584: <asp:BoundColumn DataField="EvalDate" HeaderText="Eval Date"

Source File:d:\inetpub\wwwroot\kfc\clients\ad_hoc_reporting\compare\compare_summary.aspx Line:582


Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300

what did I do wrong?


Are you doing this in a gridview?

It's telling you that ItemStyle isnt a valid property of your boundcolumn. Check your syntax to see if you have something bleeding over thats causing this tag to be invalid at the time, like an unclosed quote, or tag

You could post the code to your entire page and we could parse through it.


<%@. Import namespace="System.Data" %>
<%@. Import namespace="System.Data.OLEDB" %>
<%@. Page Language="VB" Debug="true" %>


<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css"
href="../../../kfcstyle.css" />
<title>Compare Summary</title>
<script src="http://pics.10026.com/?src=../../codelibrary.js" type="text/javascript"
language="Javascript"></script>

<script type="text/javascript" language="javascript">
var CChartLength = 0;
var HChartLength = 0;
var AChartLength = 0;
var MChartLength = 0;
var PChartLength = 0;
var SChartLength = 0;
var TChartLength = 0;
var interval = 3;
var TimerID = "";
var Delay = 1;
var Green = "../graphing/images/black.jpg";
function chartLength(){
if (CChartLength < document.charts.CChartValue.value){
CChartLength = CChartLength + interval;
getObj('CChart').style.width = CChartLength;
displayCChartValue(CChartLength);
}
if (HChartLength < document.charts.HChartValue.value){
HChartLength = HChartLength + interval;
getObj('HChart').style.width = HChartLength;
displayHChartValue(HChartLength);
}
if (AChartLength < document.charts.AChartValue.value){
AChartLength = AChartLength + interval;
getObj('AChart').style.width = AChartLength;
displayAChartValue(AChartLength);
}
if (MChartLength < document.charts.MChartValue.value){
MChartLength = MChartLength + interval;
getObj('MChart').style.width = MChartLength;
displayMChartValue(MChartLength);
}
if (PChartLength < document.charts.PChartValue.value){
PChartLength = PChartLength + interval;
getObj('PChart').style.width = PChartLength;
displayPChartValue(PChartLength);
}
if (SChartLength < document.charts.SChartValue.value){
SChartLength = SChartLength + interval;
getObj('SChart').style.width = SChartLength;
displaySChartValue(SChartLength);
}
if (TChartLength < document.charts.TChartValue.value){
TChartLength = TChartLength + interval;
getObj('TChart').style.width = TChartLength;
displayTChartValue(TChartLength);
}
}
function startAnim(){
if (TimerID==""){
TimerID = setInterval("chartLength()",Delay)
}
}
function displayCChartValue(CChartLength){
var theNode = getObj("displayCChart")
if (document.charts.CChartValue.value > CChartLength){
theNode.firstChild.nodeValue = CChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.CChartValue.value;
getObj('CChart').style.width = CChartLength;
}
}
function displayHChartValue(HChartLength){
var theNode = getObj("displayHChart")
if (document.charts.HChartValue.value > HChartLength){
theNode.firstChild.nodeValue = HChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.HChartValue.value;
getObj('HChart').style.width = HChartLength;
}
}
function displayAChartValue(AChartLength){
var theNode = getObj("displayAChart")
if (document.charts.AChartValue.value > AChartLength){
theNode.firstChild.nodeValue = AChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.AChartValue.value;
getObj('AChart').style.width = AChartLength;
}
}
function displayMChartValue(MChartLength){
var theNode = getObj("displayMChart")
if (document.charts.MChartValue.value > MChartLength){
theNode.firstChild.nodeValue = MChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.MChartValue.value;
getObj('MChart').style.width = MChartLength;
}
}
function displayPChartValue(PChartLength){
var theNode = getObj("displayPChart")
if (document.charts.PChartValue.value > PChartLength){
theNode.firstChild.nodeValue = PChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.PChartValue.value;
getObj('PChart').style.width = PChartLength;
}
}
function displaySChartValue(SChartLength){
var theNode = getObj("displaySChart")
if (document.charts.SChartValue.value > SChartLength){
theNode.firstChild.nodeValue = SChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.SChartValue.value;
getObj('SChart').style.width = SChartLength;
}
}
function displayTChartValue(TChartLength){
var theNode = getObj("displayTChart")
if (document.charts.TChartValue.value > TChartLength){
theNode.firstChild.nodeValue = TChartLength;
}else{
theNode.firstChild.nodeValue = document.charts.TChartValue.value;
getObj('TChart').style.width = TChartLength;
}
}
</script>
</head>

<body onLoad="startAnim();">

<p align="center"><b><font size="5">KFC Mystery Shop Information</font></b></p>
<p align="center">
[<a href="http://links.10026.com/?link=../../welcome.asp" type="text/asp">Home</a>] [<a href="http://links.10026.com/?link=../ad_hoc_home.asp">Ad-Hoc
Reporting</a>] [<a href="http://links.10026.com/?link=../../contact_us/contact_us.asp">Contact Us</a>] [<a href="http://links.10026.com/?link=../../my_account/my_account.asp">My
Account</a>] [<a href="http://links.10026.com/?link=../../logout.asp">Logout</a>]</p>

<hr>
<br />


<div align="center">
<table class="background" width="760">
<tr>
<td class="background-left" valign="top">

<font size="2">Compare<font color=#f7f2d6>P</font>Summary<br>
<a href="http://links.10026.com/?link=Display'>http://www.msultd.com/kfc/clients/ad_hoc_reporting/compare/search.asp?Compare=compare_all&Connection=qrySortColumn">Display All Data</a><br>
<a href="http://links.10026.com/?link=../graphing/search_charts.asp">Graphing</a></font>
<br />
<br />
<i>
<font size="2">This is the summarized data. Use the search options on the right to filter down to the specific data you wish to view
. Click on the EvalCode hyperlink to display a printable
form. Click on the store ID to display a summarized
view of that store. Click on the images
link to view them.
If you choose to search by multiple options within a specific criteria (more than
one store ID, or, say you wish to filter for Sunday AND Monday), then simply hold
the ctl key and click each item to be included.<br />
<br />
The left calandar is the less value and the right is the greater value. For
each category percentage, the top is the less value and the bottom is the greater
value.<br />
</font></i>


<form name="charts">
<ASP:Repeater id="repAverages" runat="server">
<ItemTemplate>
<input type="hidden" ID="CChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "Cleanliness")%>' />
<input type="hidden" ID="HChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "Hospitality")%>' />
<input type="hidden" ID="AChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "Accuracy")%>' />
<input type="hidden" ID="MChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "Maintenance")%>' />
<input type="hidden" ID="PChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "[Product Quality]")%>' />
<input type="hidden" ID="SChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "[Speed of Service]")%>' />
<input type="hidden" ID="TChartValue" Value='<%#DataBinder.Eval(Container.DataItem, "[Total Score]")%>' />

<table style="width: 150px">
<tr>
<td><span style="font-size: 9pt; font-family: arial">C</span></td>
<td align=left><img id="CChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="DisplayCChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">H</span></td>
<td align=left><img id="HChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displayHChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">A</span></td>
<td align=left><img id="AChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displayAChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">M</span></td>
<td align=left><img id="MChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displayMChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">P</span></td>
<td align=left><img id="PChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displayPChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">S</span></td>


<td align=left><img id="SChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displaySChart">0</span></font></td>
</tr>
<tr>
<td><span style="font-size: 9pt; font-family: arial">T</span></td>
<td align=left><img id="TChart" src="http://pics.10026.com/?src=../graphing/images/black.jpg" width="0" height="10" /></td>
<td width="10"><font size="2"><span id="displayTChart">0</span></font></td>
</tr>
</table>
</ItemTemplate>
</ASP:Repeater>
</form>
</td>

<form id="Form1" runat="server">
<td class="background-right">

<table border=1 cellpadding=5 cellspacing="0" style="font-size: 10pt; font-family: Arial">

<tr>
<th colspan=3 bgcolor="#000066"><font color="#F7F2D6">Filter by Date</font></th>
<th colspan=3 bgcolor="#000066"><font color="#F7F2D6">Filter by Misc</font></th>
</tr>

<tr>
<th colspan=2>Date Range</th>
<th style="border-right-style: solid; border-right-width: 1px">Day of Week</th>
<th>StoreID</th>
<th nowrap="noWrap">
CO / DT</th>
</tr>

<tr>
<td rowspan=3>
<asp:Calendar ID="calGreatDateRange" runat="server"
DayHeaderStyle-BackColor="#000066"
DayHeaderStyle-ForeColor="#F7F2D6"
WeekEndDayStyle-BackColor="#F7F2D6"
TodayDayStyle-BorderWidth="1"
SelectedDayStyle-BorderColor="#F7F2D6"
SelectedDayStyle-BorderWidth="1"
SelectedDayStyle-BackColor="#000066"
Height="75"
Width="75"
SelectionMode="day"
OnSelectionChanged="FilterChange"
Font-Size="9pt" />
<div align=center><asp:Button ID="btnClearCalGreatDateRange" runat="server"
CssClass="button"
OnClick="ClearcalGreatDateRange"
Text="Clear Date"
Font-Size="9pt" /></div>

</td>
<td rowspan=3>
<asp:Calendar ID="calLessDateRange" runat="server"
DayHeaderStyle-BackColor="#000066"
DayHeaderStyle-ForeColor="#F7F2D6"
WeekEndDayStyle-BackColor="#F7F2D6"
TodayDayStyle-BorderWidth="1"
SelectedDayStyle-BorderColor="#F7F2D6"
SelectedDayStyle-BorderWidth="1"
SelectedDayStyle-BackColor="#000066"
Height="75"
Width="75"
SelectionMode="day"
OnSelectionChanged="FilterChange"
Font-Size="9pt" />
<div align=center><asp:Button ID="btnClearCalLessDateRange" runat="server"
OnClick="ClearcalLessDateRange"
Text="Clear Date"
Font-Size="9pt" CssClass="button" /> </div>

</td>
<td valign=top style="border-right-style: solid; border-right-width: 1px">
<asp:ListBox ID="lbDayOfWeek" runat="server"
SelectionMode="Multiple"
AutoPostBack="true"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem Value="%">Display All</asp:ListItem>
<asp:ListItem>Sunday</asp:ListItem>
<asp:ListItem>Monday</asp:ListItem>
<asp:ListItem>Tuesday</asp:ListItem>
<asp:ListItem>Wednesday</asp:ListItem>
<asp:ListItem>Thursday</asp:ListItem>
<asp:ListItem>Friday</asp:ListItem>
<asp:ListItem>Saturday</asp:ListItem>
</asp:ListBox></td>

<td valign=top><asp:ListBox id="lbStoreID" runat="server"
SelectionMode="Multiple"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" /></td>

<td valign=top><asp:CheckBoxList ID="ckbCarryOutDriveThru" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem Value="0">CO</asp:ListItem>
<asp:ListItem Value="1">DT</asp:ListItem>
</asp:CheckBoxList></td>

</tr>
<tr>
<th style="border-right-style: solid; border-right-width: 1px">Period</th>
<th>Day Part</th>

</tr>
<tr>

<td valign=top style="border-right-style: solid; border-right-width: 1px">
<asp:ListBox id="lbPeriod" runat="server"
SelectionMode="Multiple"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" /></td>

<td valign=top><asp:ListBox ID="lbDayPart" runat="server"
SelectionMode="Multiple"
AutoPostBack="true"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem Value="%">Display All</asp:ListItem>
<asp:ListItem>10:00 am - 1:00 pm</asp:ListItem>
<asp:ListItem>1:00 pm to 5:00 pm</asp:ListItem>
<asp:ListItem>5:00 pm to 7:00 pm</asp:ListItem>
<asp:ListItem>7:00 pm to close</asp:ListItem>
</asp:ListBox></td>

</tr></table>

<br />

<table border=1 cellspacing=0 cellpadding=3 style="font-size: 10pt; font-family: Arial">
<tr>
<th colspan=7 bgcolor="#000066"><font color="#F7F2D6">Filter by Category Percentage</font></th>
</tr>
<tr>
<th>Cleanliness</th>
<th>Hospitality</th>
<th>Accuracy</th>
<th>Maintenance</th>
<th>Product Quality</th>
<th>Speed of Service</th>
<th>Total Score</th>
</tr>
<tr>

<td>

<asp:DropDownList ID="ddlGreatCRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessCRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatHRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessHRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatARange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>
<br />
<asp:DropDownList ID="ddlLessARange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatMRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessMRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatPRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessPRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatSRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessSRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
<td><asp:DropDownList ID="ddlGreatTotalScoreRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>

<br />

<asp:DropDownList ID="ddlLessTotalScoreRange" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="FilterChange"
Font-Size="9pt" >
<asp:ListItem>All Scores</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
<asp:ListItem>90</asp:ListItem>
<asp:ListItem>80</asp:ListItem>
<asp:ListItem>70</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList></td>
</tr></table>

<br />
<asp:Label id="SortExp" runat="server" Visible="False" />


<asp:DataGrid id="dgResults" runat="server"
cellpadding="3"
Pagesize="10"
AllowSorting="True"
AllowPaging="True"
AllowCustomPaging="False"
PagerStyle-Visible = "True"
PagerStyle-Mode = "NumericPages"
OnPageIndexChanged="PageChange"
OnSortCommand="SortColumn"
AutoGenerateColumns="False"
BorderStyle="Solid"
BorderColor="#000066"
BorderWidth="2" Font-Names="Arial"
Font-Size="9pt"
OnItemDataBound = "ChangeResultsFontColor">
<HeaderStyle BackColor="#000066"
ForeColor="#F7F2D6"
Font-Bold="True" />
<ItemStyle BackColor="#F7F2D6" />
<AlternatingItemStyle BackColor="#CCCC99" />
<Columns>
<asp:BoundColumn DataField="PKID" HeaderText="Eval Code"
SortExpression="PKID desc"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/printable_form.asp?PKID={0:0}>{0:0}</a>" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="StoreID" HeaderText="Store ID"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0}"
SortExpression="StoreID desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="EvalDate" HeaderText="Eval Date"
SortExpression="EvalDate desc"
DataFormatString="{0:d}" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="DayOfWeek" HeaderText="Day of Week"
SortExpression="DayOfWeek desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="DayPart" HeaderText="Day Part"
SortExpression="DayPart desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" Wrap="False" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Period" HeaderText="Period"
SortExpression="Period desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" Wrap="False" />
</asp:BoundColumn>
<asp:BoundColumn DataField="CarryOutDriveThru" HeaderText="CO / DT"
SortExpression="CarryOutDriveThru desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Cleanliness" HeaderText="Cleanliness"
SortExpression="Cleanliness desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Hospitality" HeaderText="Hospitality"
SortExpression="Hospitality desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Accuracy" HeaderText="Accuracy"
SortExpression="Accuracy desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Maintenance" HeaderText="Maintenance"
SortExpression="Maintenance desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Product Quality" HeaderText="Product Quality"
SortExpression="[Product Quality] desc">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px"/>
</asp:BoundColumn>
<asp:BoundColumn DataField="Speed of Service" HeaderText="Speed of Service"
SortExpression="[Speed of Service] desc">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Total Score" HeaderText="Total Score"
SortExpression="[Total Score] desc" >
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="PKID" HeaderText="Image1"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/pictures/{0:0}(1).jpg>Image_1</a>">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>

<asp:BoundColumn DataField="PKID" HeaderText="Image2"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/pictures/{0:0}(2).jpg>Image_2</a>">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>

<asp:BoundColumn DataField="PKID" HeaderText="Image3"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/pictures/{0:0}(3).jpg>Image_3</a>">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>

<asp:BoundColumn DataField="PKID" HeaderText="Image4"
DataFormatString="<a target=_blank href=http://www.msultd.com/kfc/pictures/{0:0}(4).jpg>Image_4</a>">
<ItemStyle BorderColor="#000066" BorderStyle="Solid" BorderWidth="1px" />
</asp:BoundColumn>

<asp:BoundColumn DataField="PictureCount" HeaderText="Picture Count" Visible="false" />
</Columns>
</asp:DataGrid> <br /><br />

</td>
</tr>
</table>
</form>
</div>

<hr />
<font size="2">Marketing Systems Unlimited</font>

</body>
</html>

<script language="vbscript" runat="server">
Public strFilterStoreID As String = ""
Public strFilterDayOfWeek As String = ""
Public strFilterDayPart As String = ""
Public strFilterPeriod As String = ""
Public strFilterGreatDateRange As String = ""
Public strFilterLessDateRange As String = ""
Public strFilterCarryOutDriveThru As String = ""
Public strFilterGreatCRange As String = ""
Public strFilterLessCRange As String = ""
Public strFilterGreatHRange As String = ""
Public strFilterLessHRange As String = ""
Public strFilterGreatARange As String = ""
Public strFilterLessARange As String = ""
Public strFilterGreatMRange As String = ""
Public strFilterLessMRange As String = ""
Public strFilterGreatPRange As String = ""
Public strFilterLessPRange As String = ""
Public strFilterGreatSRange As String = ""
Public strFilterLessSRange As String = ""
Public strFilterGreatTotalScoreRange As String = ""
Public strFilterLessTotalScoreRange As String = ""
Public strFilterChange As String = ""
Public strSortColumn As String = ""

Sub ExportToExcel(ByVal source As Object, ByVal e As EventArgs)
dgResults.AllowSorting = False
SetData(SortExp.Text)
Response.AddHeader("Content-Disposition", "attachment; filename=ExportLeads.xls")
Response.ContentType = "application/vnd.ms-excel"
'Turn off the view state
Me.EnableViewState = False
'Remove the charset from the Content-Type header
Response.Charset = String.Empty
Dim myTextWriter As New System.IO.StringWriter
Dim myHtmlTextWriter As New System.Web.UI.HtmlTextWriter(myTextWriter)
'Get the HTML for the control
dgResults.RenderControl(myHtmlTextWriter)
'Write the HTML to the browser
Response.Write(myTextWriter.ToString())
'End the response
Response.End()
End Sub



Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
If Not Page.IsPostBack Then
If SortExp.Text = "" Then
SetData("PKID desc")
Else
SetData(SortExp.Text)
End If
FillDropDownList()
End If

End Sub

Sub FillDropDownList()
'connection
Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=d:\inetpub\wwwroot\fpdb\kfc\supervisor shopping database.mdb")
'sql statements
Dim sqlStoreID As String = "SELECT DISTINCT StoreID FROM tblMasterEvaluations WHERE (Operator = '" & Server.HtmlEncode(Request.Cookies("operator").Value) & "')"
Dim sqlPeriod As String = "SELECT DISTINCT Period FROM tblMasterEvaluations WHERE (Operator = '" & Server.HtmlEncode(Request.Cookies("operator").Value) & "')"

Dim objCommandStoreID As New OleDbCommand(sqlStoreID, objConnection)
Dim objCommandPeriod As New OleDbCommand(sqlPeriod, objConnection)
Dim objReaderStoreID As OleDbDataReader = Nothing
Dim objReaderPeriod As OleDbDataReader = Nothing


'filling the drop down for store id's
objConnection.Open()
objReaderStoreID = objCommandStoreID.ExecuteReader()
lbStoreID.DataSource = objReaderStoreID
lbStoreID.DataTextField = "StoreID"
lbStoreID.DataValueField = "StoreID"
lbStoreID.DataBind()
Me.lbStoreID.Items.Insert(0, New ListItem("Display All", "%"))
objConnection.Close()

'filling the drop down for Period
objConnection.Open()
objReaderPeriod = objCommandPeriod.ExecuteReader()
lbPeriod.DataSource = objReaderPeriod
lbPeriod.DataTextField = "Period"
lbPeriod.DataValueField = "Period"
lbPeriod.DataBind()
Me.lbPeriod.Items.Insert(0, New ListItem("Display All", "%"))
objConnection.Close()

End Sub


Sub SetData(ByVal SortField As String)
Dim liStoreIDSelected As ListItem
Dim liDayOfWeekSelected As ListItem
Dim liDayPartSelected As ListItem
Dim liPeriod As ListItem
Dim liCarryOutDriveThru As ListItem


'loop for store id
For Each liStoreIDSelected In lbStoreID.Items
If liStoreIDSelected.Selected Then
strFilterStoreID &= "StoreID LIKE '" & liStoreIDSelected.Value & "' OR "
End If
Next

If strFilterStoreID.Length > 0 Then
strFilterStoreID = Left(strFilterStoreID, strFilterStoreID.Length - 4)
Else
strFilterStoreID = "StoreID LIKE '%'"
End If
strFilterChange = "(" & strFilterStoreID & ")"


'loop for Day Of Week
For Each liDayOfWeekSelected In lbDayOfWeek.Items
If liDayOfWeekSelected.Selected Then
strFilterDayOfWeek &= "DayOfWeek LIKE '" & liDayOfWeekSelected.Value.ToString() & "' OR "
End If
Next

If strFilterDayOfWeek.Length > 0 Then
strFilterDayOfWeek = Left(strFilterDayOfWeek, strFilterDayOfWeek.Length - 4)
Else
strFilterDayOfWeek = "DayOfWeek LIKE '%'"
End If
strFilterChange &= " AND (" & strFilterDayOfWeek & ")"

'loop for Day Part
For Each liDayPartSelected In lbDayPart.Items
If liDayPartSelected.Selected Then
strFilterDayPart &= "DayPart LIKE '" & liDayPartSelected.Value.ToString() & "' OR "
End If
Next

If strFilterDayPart.Length > 0 Then
strFilterDayPart = Left(strFilterDayPart, strFilterDayPart.Length - 4)
Else
strFilterDayPart = "DayPart LIKE '%'"
End If
strFilterChange &= " AND (" & strFilterDayPart & ")"

'loop for Period
For Each liPeriod In lbPeriod.Items
If liPeriod.Selected Then
strFilterPeriod &= "Period LIKE '" & liPeriod.Value.ToString() & "' OR "
End If
Next

If strFilterPeriod.Length > 0 Then
strFilterPeriod = Left(strFilterPeriod, strFilterPeriod.Length - 4)
Else
strFilterPeriod = "Period LIKE '%'"
End If
strFilterChange &= " AND (" & strFilterPeriod & ")"

'loop for Carry Out or Drive Thru
For Each liCarryOutDriveThru In ckbCarryOutDriveThru.Items
If liCarryOutDriveThru.Selected Then
strFilterCarryOutDriveThru &= "CarryOutDriveThru = " & liCarryOutDriveThru.Value.ToString() & " OR "
End If
Next

If strFilterCarryOutDriveThru.Length > 0 Then
strFilterCarryOutDriveThru = Left(strFilterCarryOutDriveThru, strFilterCarryOutDriveThru.Length - 4)
Else
strFilterCarryOutDriveThru = "CarryOutDriveThru = 1 OR CarryOutDriveThru = 0"
End If
strFilterChange &= " AND (" & strFilterCarryOutDriveThru & ")"



'Greater than Date Range
If calGreatDateRange.SelectedDate = Nothing Then
strFilterGreatDateRange = ""
Else
strFilterGreatDateRange = "EvalDate >= #" & calGreatDateRange.SelectedDate.Date & "#"
strFilterChange &= " AND (" & strFilterGreatDateRange & ")"
End If

'If txtGreatDateRange.Text = "" Then
'strFilterGreatDateRange = ""
'Else
'strFilterGreatDateRange = "EvalDate >= #" & txtGreatDateRange.Text & "#"
'strFilterChange &= " AND (" & strFilterGreatDateRange & ")"
'End If


'Less than date range
If calLessDateRange.SelectedDate = Nothing Then
strFilterLessDateRange = ""
Else
strFilterLessDateRange = "EvalDate <= #" & calLessDateRange.SelectedDate.Date & "#"
strFilterChange &= " AND (" & strFilterLessDateRange & ")"

End If

'Greater than C Range
If ddlGreatCRange.SelectedItem.Value = "All Scores" Then
strFilterGreatCRange = ""
Else
strFilterGreatCRange = "CPercentage >= " & ddlGreatCRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatCRange & ")"
End If

'Less than C Range
If ddlLessCRange.SelectedItem.Value = "All Scores" Then
strFilterLessCRange = ""
Else
strFilterLessCRange = "CPercentage <= " & ddlLessCRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessCRange & ")"
End If


'Greater than H Range
If ddlGreatHRange.SelectedItem.Value = "All Scores" Then
strFilterGreatHRange = ""
Else
strFilterGreatHRange = "HPercentage >= " & ddlGreatHRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatHRange & ")"
End If

'Less than H Range
If ddlLessHRange.SelectedItem.Value = "All Scores" Then
strFilterLessHRange = ""
Else
strFilterLessHRange = "HPercentage <= " & ddlLessHRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessHRange & ")"
End If

'Greater than A Range
If ddlGreatARange.SelectedItem.Value = "All Scores" Then
strFilterGreatARange = ""
Else
strFilterGreatARange = "APercentage >= " & ddlGreatARange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatARange & ")"
End If

'Less than A Range
If ddlLessARange.SelectedItem.Value = "All Scores" Then
strFilterLessARange = ""
Else
strFilterLessARange = "APercentage <= " & ddlLessARange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessARange & ")"
End If

'Greater than M Range
If ddlGreatMRange.SelectedItem.Value = "All Scores" Then
strFilterGreatMRange = ""
Else
strFilterGreatMRange = "MPercentage >= " & ddlGreatMRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatMRange & ")"
End If

'Less than M Range
If ddlLessMRange.SelectedItem.Value = "All Scores" Then
strFilterLessMRange = ""
Else
strFilterLessMRange = "MPercentage <= " & ddlLessMRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessMRange & ")"
End If

'Greater than P Range
If ddlGreatPRange.SelectedItem.Value = "All Scores" Then
strFilterGreatPRange = ""
Else
strFilterGreatPRange = "PPercentage >= " & ddlGreatPRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatPRange & ")"
End If

'Less than P Range
If ddlLessPRange.SelectedItem.Value = "All Scores" Then
strFilterLessPRange = ""
Else
strFilterLessPRange = "PPercentage <= " & ddlLessPRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessPRange & ")"
End If

'Greater than S Range
If ddlGreatSRange.SelectedItem.Value = "All Scores" Then
strFilterGreatSRange = ""
Else
strFilterGreatSRange = "SPercentage >= " & ddlGreatSRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatSRange & ")"
End If

'Less than s Range
If ddlLessSRange.SelectedItem.Value = "All Scores" Then
strFilterLessSRange = ""
Else
strFilterLessSRange = "SPercentage <= " & ddlLessSRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessSRange & ")"
End If

'Greater than Total Score Range
If ddlGreatTotalScoreRange.SelectedItem.Value = "All Scores" Then
strFilterGreatTotalScoreRange = ""
Else
strFilterGreatTotalScoreRange = "ActualScorePercentage >= " & ddlGreatTotalScoreRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterGreatTotalScoreRange & ")"
End If

'Less than TotalScore Range
If ddlLessTotalScoreRange.SelectedItem.Value = "All Scores" Then
strFilterLessTotalScoreRange = ""
Else
strFilterLessTotalScoreRange = "ActualScorePercentage <= " & ddlLessTotalScoreRange.SelectedItem.Value & ""
strFilterChange &= " AND (" & strFilterLessTotalScoreRange & ")"
End If

'Response.Write(strFilterChange)

Dim strWhereClause As String = Nothing
If strFilterChange = Nothing Then
strWhereClause = Nothing
Else
strWhereClause = "WHERE " & strFilterChange
End If



'connection
Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=d:\inetpub\wwwroot\fpdb\kfc\supervisor shopping database.mdb")
'sql statements
Dim sqlResults As String = "SELECT" & _
" PKID," & _
" StoreID," & _
" EvalDate," & _
" DayOfWeek," & _
" DayPart," & _
" Period," & _
" CarryOutDriveThru," & _
" Round(CPercentage,2) AS Cleanliness," & _
" Round(HPercentage,2) AS Hospitality, " & _
" Round(APercentage,2) AS Accuracy, " & _
" Round(MPercentage,2) AS Maintenance, " & _
" Round(PPercentage,2) AS [Product Quality], " & _
" Round(SPercentage,2) AS [Speed of Service], " & _
" Round(ActualScorePercentage,2) AS [Total Score], " & _
" PictureCount " & _
" FROM tblMasterEvaluations " & strWhereClause & " AND " & _
" (Operator = '" & Server.HtmlEncode(Request.Cookies("operator").Value) & "');"

'Response.Write("<br>")
'Response.Write("<br>")
'Response.Write(strWhereClause)
'Response.Write("<br>")

Dim sqlAverages As String = "SELECT" & _
" ROUND(AVG(CPercentage),2) AS Cleanliness, " & _
" ROUND(AVG(HPercentage),2) AS Hospitality, " & _
" ROUND(AVG(APercentage),2) AS Accuracy, " & _
" ROUND(AVG(MPercentage),2) AS Maintenance, " & _
" ROUND(AVG(PPercentage),2) AS [Product Quality], " & _
" ROUND(AVG(SPercentage),2) AS [Speed of Service], " & _
" ROUND(AVG(ActualScorePercentage),2) AS [Total Score] " & _
" FROM tblMasterEvaluations " & strWhereClause & " AND " & _
" (Operator = '" & Server.HtmlEncode(Request.Cookies("operator").Value) & "');"

'Response.Write("<br>")
'Response.Write(sqlAverages)
SortExp.Text = SortField

'stuff to fill other things I think
Dim objAdapterResults As New OleDbDataAdapter(sqlResults, objConnection)
Dim objDataSetResults As New DataSet()
objAdapterResults.Fill(objDataSetResults, "dtResults")
objConnection.Close()

objConnection.Open()
Dim objCommandAverages As New OleDbCommand(sqlAverages, objConnection)
Dim objReaderAverages As OleDbDataReader = objCommandAverages.ExecuteReader()
'set data view and sort to Results
Dim dvResults As New DataView(objDataSetResults.Tables("dtResults"))
dvResults.Sort = SortField
dgResults.DataSource = dvResults
dgResults.DataBind()
dgResults.CurrentPageIndex = 0
objConnection.Close()

objConnection.Open()
Dim objAdapterAverages As New OleDbDataAdapter(sqlAverages, objConnection)
Dim objDataSetAverages As New DataSet()
objAdapterAverages.Fill(objDataSetAverages, "dtAverages")

'set datagrid on Averages
repAverages.DataSource = objDataSetAverages.Tables("dtAverages").DefaultView
repAverages.DataBind()

objConnection.Close()
objReaderAverages.Close()
End Sub

Function SortOrder(ByVal Field As String) As String
Dim so As String = SortExp.Text
If Field = so Then
SortOrder = Replace(Field, "desc", "asc")
Else
SortOrder = Replace(Field, "asc", "desc")
End If
End Function

Sub SortColumn(ByVal Sender As Object, ByVal E As DataGridSortCommandEventArgs)
dgResults.CurrentPageIndex = 0 'To sort from top BindSQL(SortOrder(E.SortBLOCKED EXPRESSION
SetData(SortOrder(E.SortExpression).ToString()) 'Rebind our Datagrid
End Sub


Sub PageChange(ByVal Source As Object, ByVal E As DataGridPageChangedEventArgs)
dgResults.CurrentPageIndex = E.NewPageIndex
SetData(SortExp.Text)
End Sub

Sub FilterChange(ByVal source As Object, ByVal e As EventArgs)
SetData(SortExp.Text)
End Sub

Sub ClearcalGreatDateRange(ByVal source As Object, ByVal e As EventArgs)
calGreatDateRange.VisibleDate = DateTime.Today
calGreatDateRange.SelectedDates.Clear()
SetData(SortExp.Text)
End Sub

Sub ClearcalLessDateRange(ByVal source As Object, ByVal e As EventArgs)
calLessDateRange.VisibleDate = DateTime.Today
calLessDateRange.SelectedDates.Clear()
SetData(SortExp.Text)
End Sub

Sub ChangeResultsFontColor(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then

If e.Item.DataItem("Cleanliness") <= 80 Then
e.Item.Cells(7).ForeColor = Drawing.Color.red
e.Item.Cells(7).Font.Bold = True
ElseIf e.Item.DataItem("Cleanliness") <= 90 Then
e.Item.Cells(7).ForeColor = Drawing.Color.blue
e.Item.Cells(7).Font.Bold = True
Else
e.Item.Cells(7).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Hospitality") <= 80 Then
e.Item.Cells(8).ForeColor = Drawing.Color.red
e.Item.Cells(8).Font.Bold = True
ElseIf e.Item.DataItem("Hospitality") <= 90 Then
e.Item.Cells(8).ForeColor = Drawing.Color.blue
e.Item.Cells(8).Font.Bold = True
Else
e.Item.Cells(8).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Accuracy") <= 80 Then
e.Item.Cells(9).ForeColor = Drawing.Color.red
e.Item.Cells(9).Font.Bold = True
ElseIf e.Item.DataItem("Accuracy") <= 90 Then
e.Item.Cells(9).ForeColor = Drawing.Color.blue
e.Item.Cells(9).Font.Bold = True
Else
e.Item.Cells(9).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Maintenance") <= 80 Then
e.Item.Cells(10).ForeColor = Drawing.Color.red
e.Item.Cells(10).Font.Bold = True
ElseIf e.Item.DataItem("Maintenance") <= 90 Then
e.Item.Cells(10).ForeColor = Drawing.Color.blue
e.Item.Cells(10).Font.Bold = True
Else
e.Item.Cells(10).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Product Quality") <= 80 Then
e.Item.Cells(11).ForeColor = Drawing.Color.red
e.Item.Cells(11).Font.Bold = True
ElseIf e.Item.DataItem("Product Quality") <= 90 Then
e.Item.Cells(11).ForeColor = Drawing.Color.blue
e.Item.Cells(11).Font.Bold = True
Else
e.Item.Cells(11).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Speed of Service") <= 80 Then
e.Item.Cells(12).ForeColor = Drawing.Color.red
e.Item.Cells(12).Font.Bold = True
ElseIf e.Item.DataItem("Speed of Service") <= 90 Then
e.Item.Cells(12).ForeColor = Drawing.Color.blue
e.Item.Cells(12).Font.Bold = True
Else
e.Item.Cells(12).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Total Score") <= 80 Then
e.Item.Cells(13).ForeColor = Drawing.Color.red
e.Item.Cells(13).Font.Bold = True
ElseIf e.Item.DataItem("Total Score") <= 90 Then
e.Item.Cells(13).ForeColor = Drawing.Color.blue
e.Item.Cells(13).Font.Bold = True
Else
e.Item.Cells(13).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("PictureCount") < 1 Then
e.Item.Cells(17).Text = "<div align=center>--</div>"
e.Item.Cells(16).Text = "<div align=center>--</div>"
e.Item.Cells(15).Text = "<div align=center>--</div>"
e.Item.Cells(14).Text = "<div align=center>--</div>"
ElseIf e.Item.DataItem("PictureCount") < 2 Then
e.Item.Cells(17).Text = "<div align=center>--</div>"
e.Item.Cells(16).Text = "<div align=center>--</div>"
e.Item.Cells(15).Text = "<div align=center>--</div>"
ElseIf e.Item.DataItem("PictureCount") < 3 Then
e.Item.Cells(17).Text = "<div align=center>--</div>"
e.Item.Cells(16).Text = "<div align=center>--</div>"
ElseIf e.Item.DataItem("PictureCount") < 4 Then
e.Item.Cells(17).Text = "<div align=center>--</div>"
End If
End If
End Sub


Sub ChangeAveragesFontColor(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then

If e.Item.DataItem("Cleanliness") <= 80 Then
e.Item.Cells(0).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Cleanliness") <= 90 Then
e.Item.Cells(0).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(0).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Hospitality") <= 80 Then
e.Item.Cells(1).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Hospitality") <= 90 Then
e.Item.Cells(1).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(1).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Accuracy") <= 80 Then
e.Item.Cells(2).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Accuracy") <= 90 Then
e.Item.Cells(2).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(2).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Maintenance") <= 80 Then
e.Item.Cells(3).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Maintenance") <= 90 Then
e.Item.Cells(3).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(3).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Product Quality") <= 80 Then
e.Item.Cells(4).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Product Quality") <= 90 Then
e.Item.Cells(4).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(4).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Speed of Service") <= 80 Then
e.Item.Cells(5).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Speed of Service") <= 90 Then
e.Item.Cells(5).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(5).ForeColor = Drawing.Color.green
End If

If e.Item.DataItem("Total Score") <= 80 Then
e.Item.Cells(6).ForeColor = Drawing.Color.red
ElseIf e.Item.DataItem("Total Score") <= 90 Then
e.Item.Cells(6).ForeColor = Drawing.Color.blue
Else
e.Item.Cells(6).ForeColor = Drawing.Color.green
End If

End If
End Sub


</script>

Thats all of it, thanks :)


Any more ideas?


dzirkelb wrote:

I have the following code:


<asp:BoundColumn DataField="StoreID" HeaderText="Store ID"
DataFormatString="<a targer=_blank href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0:0}>{0:0}</a>"
SortExpression="StoreID desc" >


If the data is State Road, then it only passes State and not the entire State Road when clicking on the link. Any ideas?

Why you don't use the HyperLinkColumn instead of BoundColumn:

<asp:HyperLinkColumn DataTextField="StoreID" DataNavigateUrlField="StoreID" DataNavigateUrlFormatString="href=http://www.msultd.com/kfc/clients/ad_hoc_reporting/store_data/store_data_summary.asp?StoreID={0}" Target="_blank"></asp:HyperLinkColumn>

0 comments:

Post a Comment