mrissi
asked on
C# Question
Ok - I have created an app which can do data entry and do look ups based on imput variables for order number. I now want to add this same functionality for a serial number. I have started to do this and I am getting all kinds of errors. I need help.
Where do I need to make changes to the attached forms to allow for my serial number entry which I have started to add.
This is off Huge importance and will problably require us going back and forth a few times ...
Attached please find my menu.aspx file as well as my menua.html and NewData.aspx (which is my main file)
Any and all help will be GREATLY APPRECIATED!!!
Menu1a.htm
<script language="JavaScript">
Menu1LastSelected = 'Menu11';
Menu2LastSelected = 'Menu21l1';
function JsFnMenu1Clicked (sClickedId,sURL)
{
var sMenu1 = "Menu1"+sClickedId.substri ng(5,6);
var sMenu2LastType = Menu2LastSelected.substrin g(6,7) == 'r' ? 'right' : 'left' ;
var sLastMenu1Eval = "document.all."+ Menu1LastSelected + ".className='Menu1Off'" ;
var sLastMenu2Eval = "document.all."+ Menu2LastSelected + ".className='Menu2Off"+ sMenu2LastType + "'" ;
var sThisMenu1Eval = "document.all."+sMenu1+".c lassName = 'Menu1On'";
var sThisMenu2Eval = "document.all."+sClickedId +".classNa me ='Menu2On'" ;
eval (sLastMenu1Eval);
eval (sLastMenu2Eval);
eval (sThisMenu1Eval);
eval (sThisMenu2Eval);
Menu1LastSelected = sMenu1;
Menu2LastSelected = sClickedId;
window.parent.frames[1].lo cation=sUR L;
} // end function
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="Menu11" class="Menu1On">Orders<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu21l1" class="Menu2On" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=Order &Mode= Create')"> Create
Order Entry</td>
<td id="Menu21r2" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=Order &Mode= Find')">Fi nd/Edit
Order</td>
<td id="Menu21r3" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=Seria l Number&Mode=Find')">Fi nd
SN</td>
</tr>
</table>
</td>
<td id="Menu12" class="Menu1Off">RMAs<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu22l3" class="Menu2OffLeft" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=RMA&a mp;Mode=Cr eate')">Cr eate
RMA Entry</td>
<td id="Menu22r4" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=RMA&a mp;Mode=Fi nd')">Find /Edit
RMA</td>
</tr>
</table>
</td>
<td id="Menu13" class="Menu1Off">Returns
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu23l5" class="Menu2OffLeft" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=Retur n&Mode =Create')" >Create
Return Entry</td>
<td id="Menu23r6" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con text=Retur n&Mode =Find')">
Find/Edit Return</td>
</tr>
</table>
</td>
</tr>
</table>
NewData.aspx
<%@ Page language="c#" Codebehind="NewData.aspx.c s" AutoEventWireup="false" Trace="false" Inherits="nsndev.NewData" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Create <%=sTranType%> Entry </title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri pt">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="nsn.css" type="text/css" rel="stylesheet">
<script language="Javascript">
var aValue ;
var bEscapeKeyMode = false ;
function jKeypress(sID, sMode)
{
//HLS Test 8/18/2003
//alert ("IN: jKeypress");
var bReturn = true;
var skey = event.keycode ;
skey = window.event.keyCode ;
if (bEscapeKeyMode == true)
{
if (substring(sID,0,4) == "TxtSN")
{
alert ( "in text sn field" );
}
}
if (skey == 92)
{
bEscapeKeyMode = true ;
}
else
{
if (skey == 32 && (sMode == "Create" || sMode=="Edit") )
{
bReturn = false;
switch (sID)
{
case "TxtTranID":
document.all.TxtProductID. focus();
if (sMode == "Create" )
{
document.all.TxtProductID. value = "";
}
break;
case "TxtProductID":
document.all.TxtAreaSN.foc us();
if (sMode == "Create" )
{
document.all.TxtAreaSN.val ue = "";
}
break;
default:
break;
}
bEscapeKeyMode = false ;
}
else
{
bEscapeKeyMode = false ;
}
}
if (!bReturn)
{
window.event.returnvalue = false ;
}
return (bReturn)
}
function SNInputClear()
{
//HLS Test 8/18/2003
//alert ("IN: SNInputClear");
document.all.TxtAreaSN.val ue = "";
}
function jPrint ()
{
//HLS Test 8/18/2003
//alert ("IN: jPrint");
var sTranID = document.all.TxtTranID.val ue;
var sDateChoice = document.forms[0].rdoTranD T[0].check ed ? "Now" : "" ;
if (sDateChoice != "Now" )
{
// get other date from 3 seperate HTML form elements
sTranDay = document.all.selTranDTDay;
sTranMo = document.all.selTranDTMont h;
sTranYr = document.all.selTranDTYear ;
sTranDT = sTranMo + "/" + sTranDay + "/" + sTranYr;
}
else
{
d = new Date();
sTranDT = "";
sTranDT += (d.getMonth() + 1) + "/";
sTranDT += d.getDate() + "/";
sTranDT += d.getYear();
}
sURL = "NewData.aspx?Context=<%=s TranType%> &TranID=" + sTranID + "&TranDT=" + sTranDT + "&Mode=" + "Print";
window.open(sURL) ;
}
function SNInputEditChange (sValue, nIndex )
{
// fires when a user corrrects a single SN
//the change is stored back into the array of SNs
//HLS Test 8/18/2003
//alert ("IN: SNInputEditChange");
aValue[nIndex] = sValue ;
document.all.TxtAreaSN.val ue = aValue.join (" " );
//HLS Test 8/19/2003
SNInputCheck();
}
function jTree (sDivID)
{
//HLS Test 8/18/2003
//alert ("IN: jTree");
sDelim = "|" ;
aValue = sDivID.split ( "|") ;
sLevel = aValue[0];
sType = aValue[1];
sOpenedOrClosed = aValue[2];
sIndex = aValue[3] + sDelim + aValue[4] + sDelim + aValue[5] + sDelim + aValue[6] ;
sDiv = sLevel + sDelim + "data" + sDelim + "closed" + sDelim + sIndex ;
oDiv = document.getElementById ( sDiv) ;
oDiv.style.display = sOpenedOrClosed == "closed" ? "none" : "inline" ;
sDiv = sLevel + sDelim + "data" + sDelim + "opened" + sDelim + sIndex ;
oDiv = document.getElementById ( sDiv) ;
oDiv.style.display = sOpenedOrClosed == "closed" ? "inline" : "none" ;
}
function SNInputEditAll()
{
//HLS Test 8/18/2003
//alert ("IN: SNInputEditAll");
document.all.DivSNCheckInv alid.style .display = "none";
document.all.DivSNCheckVal id.style.d isplay = "none";
document.all.DivSN.style.d isplay = "none";
document.all.DivSNInput.st yle.displa y = "inline" ;
document.all.TxtAreaSN.val ue = aValue.join ( " " );
}
function ProductAdd()
{
//HLS Test 8/18/2003
//alert ("IN: ProductAdd");
document.all.DivSNCheckInv alid.style .display = "none";
document.all.DivSNCheckVal id.style.d isplay = "none";
document.all.DivSN.style.d isplay = "none";
document.all.DivSNInput.st yle.displa y = "inline" ;
document.all.TxtProductID. value = "";
}
function jEdit (sID, sTranType, sTranID, sTranDT, sProductID)
{
//HLS Test 8/18/2003
//alert ("IN: jEdit");
//sUrl = "NewData.aspx?Mode=Edit&Tr anType=" + sTranType + "&TranID=" + sTranID + "&TranDT=" + sTranDT + "&ProductID=" + sProductID;
sUrl = "NewData.aspx?Mode=Edit&Co ntext=" + sTranType + "&TranID=" + sTranID + "&TranDT=" + sTranDT + "&ProductID=" + sProductID;
//alert ("IN: jEdit::" + sUrl);
//alert ("Context = " + sTranType);
window.location = sUrl;
}
function jOnChange(sID, sMode)
{
//HLS Test 8/18/2003
//alert ("IN: jOnChange");
if (sMode == "Create" || sMode=="Edit" )
{
var oID = document.getElementById(sI D);
var sText = oID.value;
sText = sText.replace ( " " , "" );
oID.value = sText ;
if ( sID == "TxtTranID")
{
document.all.TxtProductID. focus();
}
if (document.all.DivSNInput.s tyle.displ ay == "inline" )
{
if ( sID == "TxtProductID")
{
document.all.TxtAreaSN.foc us();
}
}
}
if (sMode == "Find" || sMode == "Found" || sMode == "Print")
{
// document.all.BtnFind.focus ();
}
}
function jOnLoad()
{
//HLS Test 8/18/2003
sMode = "<%=sMode%>";
sTranID = "<%=sTranID%>";
sValue = '<%=sbAreaSns%>';
sNwSN = "<%=sNwSN%>;
if (sMode == "Print")
{
return (true);
}
if (sMode == "Create" && sTranID != "")
{
document.all.TxtProductID. focus();
}
else
{
document.all.TxtTranID.foc us();
}
if (sMode == "Edit")
{
document.all.TxtAreaSN.val ue=sValue;
return (true);
}
}
function SNInputCheck()
{
// convert SN Input field to an Array of individual SNs based on InputDelimiter selected,
// and present back to the user for validation within separate HTML form input elements.
// strategy is to use the InnerHTML property of an HTML div tag to dynamically re-render
// data without round trips to the server
//HLS Test 8/18/2003
//alert ("IN: SNInputCheck");
var sInputDelimiter = " ";
// get the data from the unformatted SN data input Form
var sValue = document.all.TxtAreaSN.val ue ;
// convert the data into an array of SNs.based on input delimiter.
aValue = sValue.split (sInputDelimiter) ;
aValue.sort();
// uncomment the following three lines to debug the initial Input form data
//var sOutputDelimiter = "|";
//var sDelimitedValue = aValue.join (sOutputDelimiter);
alert (sDelimitedValue);
var sHtml = "";
var nIndex= 0;
var nValidCount = 0 ;
// Count of duplicates
var nDuplicateCount = 0;
// Flag if there is a duplicate
var bDuplicateInstance = false ;
if (sValue.length == 0 )
{
alert ( "No Serial Numbers have been entered. Please enter a serial number");
nCount = 0 ;
return (0);
}
// create a validated string first that strips out all doubles of delimiters and trailing delimiters
var sValidValue = "";
nCount = aValue.length ;
// strip out doubles of delimiters (e.g. spaces, if that's the delimiter)
for (nIndex = 0; nIndex < nCount; nIndex++)
{
if (aValue[nIndex] != sInputDelimiter && aValue[nIndex] != "" )
{
sValidValue = sValidValue+aValue[nIndex] + sInputDelimiter;
}
}
// chop off trailing delimiter
sValidValue = sValidValue.substring (0, sValidValue.length-1);
// alert (sValidValue);
// now create the array of values
aValue = sValidValue.split ( sInputDelimiter ) ;
nCount = aValue.length ;
// alert ( nCount ) ;
for (nIndex = 0; nIndex < nCount; nIndex++)
{
// check for duplicates
bDuplicateInstance = false ;
// check if the next SN is a duplicate
if (nIndex > 0)
{
if (aValue[nIndex] == aValue[nIndex-1] )
{
bDuplicateInstance = true ;
}
}
if (nIndex < (nCount + 1))
{
if (aValue[nIndex] == aValue[nIndex+1] )
{
bDuplicateInstance = true ;
}
}
// end duplicate if
// set the style to be rendered as a string to be added into the dynamic HTML'
sStyle = bDuplicateInstance ? "SNInputDuplicate" : "SNInputOK" ;
// format the dynamic HTML
sHtml = sHtml + "<input id='TxtSn"+nIndex + "' value= '" + aValue[nIndex] + "' class=" + sStyle + " onChange='SNInputEditChang e (this.value," + nIndex + ")'> " ;
// add a new line after every 5 SNs.
nValidCount++ ;
if (nValidCount % 5 == 0 )
{
sHtml= sHtml+ "<br>";
}
if ( bDuplicateInstance)
{
nDuplicateCount++ ;
}
}
// END OF FOR LOOP
// render the dynamic HTML ;
/// ggalert ( sHtml)
// Show Validation layer if user action is required prior to submit
if ( nDuplicateCount > 0)
{
document.all.DivSNCheckVal id.style.d isplay = "none";
document.all.DivSNCheckInv alid.style .display = "inline";
document.all.DivSNCountInv alid.inner HTML= 'Duplicate SNs have been entered. Please correct and select [Re-submit Serial Numbers] to continue';
}
// Show Submit layer if validation passed
else
{
document.all.DivSNCheckVal id.style.d isplay = "inline";
document.all.DivSNCheckInv alid.style .display = "none";
document.all.DivSNCountVal id.innerHT ML= nValidCount;
}
document.all.DivSN.style.d isplay = "inline";
document.all.DivSNInput.st yle.displa y = "none" ;
document.all.DivSN.innerHT ML = sHtml;
document.all.TxtAreaSN.val ue = aValue.join(" ") ;
// END OF FUNCTION
}
</script>
</HEAD>
<body onload="jOnLoad(); ">
<form id="Form1" method="post" runat="server">
<DIV id="DivPage" style="Z-INDEX: 3; LEFT: 8px; WIDTH: 798px; POSITION: absolute; TOP: 8px; HEIGHT: 221px">
<DIV id="DivMainQuery" style="display:<%=(sMode== "Print" ) ? "none" : "inline" %>">
<TABLE id="TblContextPrompt" cellSpacing="0" width="98%" border="0">
<TR>
<TD width="99%" align="left"><FONT face="Eras Bold ITC" color="#000066" size="5"><%=sMode + " "+ sTranType+ " Entry"%></FONT>
</TD>
</TR>
</TABLE>
<TABLE id="TblOrderNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"> </TD>
<TD class="prompt1" align="left" width="16%"><%=sTranType%> &nbs p;</TD>
<TD class="prompt1"><INPUT value="<%=sTranID%>" type="text" maxLength="50" size="30" name="TxtTranID" id="TxtTranID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i d, '<%=sMode%>')">
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" align="left"><%=sTranTypeD atePrompt% > Dat e: </TD>
<%
%>
<TD class="prompt1"><INPUT type="radio" <%=(bNow ? "CHECKED" : "") %> value="Now" name="rdoTranDT" id="rdoTranDTNow"><%="Toda y (" + sDtNowFormatted + ")"%> <INPUT type="radio" <%=( bNow ? "":"CHECKED" )%> value="Other" name="rdoTranDT" id="rdoTranDTOther"> Other:
<div id="DivSelectOtherMonth" style="display:inline" ><%=sBuildHtmlSelectOtherD ate()%></d iv>
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
<SELECT name="selTranDTYear" id ="selTranDTYear">
<% for (nIndex = (DtOther.Year-1); nIndex <= (DtOther.Year + 10) ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Year ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
</TD>
</TR>
</TABLE>
<div id="DivProduct" style="display:<%=(sMode== "Find" || sMode=="Found") ? "none" : "inline" %>">
<TABLE id="TblProductNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"></TD>
<TD class="prompt1" align="right" width="16%"></TD>
<TD class="prompt1"></TD>
</TR>
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%">
</TD>
<TD class="prompt1" align="left" width="16%">Product Number: </TD>
<TD class="prompt1"><INPUT value="<%=sProductID%>" type="text" id="TxtProductID" maxLength="50" size="30" name="TxtProductID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i d, '<%=sMode%>')">
</TD>
</TR>
</TABLE>
</div>
<!-- Mike added code 2004.03.16-->
<TABLE id="TblSerialNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"> </TD>
<TD class="prompt1" align="left" width="16%"><%=sTranType%> &nbs p;</TD>
<TD class="prompt1"><INPUT value="<%=sNwSN%>" type="text" maxLength="50" size="30" name="TxtTranID" id="TxtTranID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i d, '<%=sMode%>')">
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" align="left"><%=sTranTypeD atePrompt% > Dat e: </TD>
<%
%>
<TD class="prompt1"><INPUT type="radio" <%=(bNow ? "CHECKED" : "") %> value="Now" name="rdoTranDT" id="rdoTranDTNow"><%="Toda y (" + sDtNowFormatted + ")"%> <INPUT type="radio" <%=( bNow ? "":"CHECKED" )%> value="Other" name="rdoTranDT" id="rdoTranDTOther"> Other:
<div id="DivSelectOtherMonth" style="display:inline" ><%=sBuildHtmlSelectOtherD ate()%></d iv>
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
<SELECT name="selTranDTYear" id ="selTranDTYear">
<% for (nIndex = (DtOther.Year-1); nIndex <= (DtOther.Year + 10) ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Year ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
</TD>
</TR>
</TABLE>
<DIV id="DivSNAddEdit" style="display:<%=(sMode== "Create" || sMode=="Edit") ? "inline" : "none" %>">
<DIV id="DivSNInput" >
<TABLE id="TblSNPrompt" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%">
</TD>
<TD class="prompt1" align="left" width="16%">Serial Number(s): </TD>
<TD class="prompt1">Please scan or key Serial Numbers into the space below.
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1"> </TD >
<TD class="prompt1" align="left"></TD>
</TR>
<TR>
<TD></TD>
<TD class="prompt1" colSpan="2"><INPUT onclick="SNInputCheck()" type="button" align="left" value="Submit Serial Numbers" name="BtnSNInpuCheck">
<INPUT onclick="SNInputClear()" type="button" align="left" value=" Clear Serial Numbers " name="BtnSNInputClear"></T D>
</TR>
<TR>
<TD></TD>
<TD class="prompt1" colSpan="2"> </TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" colSpan="2"><TEXTAREA style="WIDTH: 100%" name="TxtAreaSN" rows="10" cols="20" accessKey="TxtAreaSN" ></TEXTAREA></TD>
</TR>
</TABLE>
</DIV>
<DIV id="DivSNCheckInvalid" style="DISPLAY: none">
<TABLE id="TblSNCheck2" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%"></TD>
<TD width="16%" class="prompt1" align="left">Serial Number(s):</TD>
<TD class="prompt2" align="left"><B><FONT color="#ff0000"><DIV id="DivSNCountInvalid" align="left" style="DISPLAY:inline">&nb sp;</DIV>
</FONT></B>
</TD>
</TR>
</TABLE>
<TABLE id="TblSNValidate1" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1">
<INPUT onclick="SNInputCheck()" type="button" value="Re-Submit Serial Numbers" name="BtnSNInputAddProduct " id="Button1">
<INPUT onClick="SNInputEditAll()" type="button" value="Freeform Scan/Edit " name="BtnSNInputFinished 42">
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1"> </TD >
</TR>
</TABLE>
</DIV>
<DIV id="DivSNCheckValid" style="DISPLAY: none">
<TABLE id="TblSNCheck" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%"></TD>
<TD width="16%" class="prompt1" align="left">Serial Number(s):</TD>
<TD class="prompt2" align="left"><B><FONT color="#ff0000"><DIV id="DivSNCountValid" align="left" style="DISPLAY:inline">&nb sp;</DIV>
</FONT></B> Serial Number(s) have been entered.
</TD>
</TR>
</TABLE>
<TABLE id="TblSNSaveMenu" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1">
<% if (sMode != "Edit") { %><INPUT runat="server" type="button" value="Add another Product" name="BtnAddProduct " id="BtnAddProduct"> & nbsp;<% } %>
<INPUT runat="server" type="button" value="Complete" name="BtnCompleteTransacti on" id="BtnCompleteTransaction ">
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1"> </TD >
</TR>
</TABLE>
</DIV>
<TABLE id="TblSNDivMenu" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD width="2%" height="21"> </TD>
<TD><DIV id="DivSN"></DIV>
<DIV></DIV>
</TD>
</TR>
</TABLE>
</DIV>
<DIV id="DivSNFind" style="display:<%=(sMode== "Print" || sMode=="Find" || sMode== "Found" ) ? "inline" : "none" %>">
<TABLE id="TblFind" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD width="2%" height="21"> </TD>
<TD align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%" height="21"> </TD>
<TD class="prompt1"><INPUT runat="server" type="button" value="Find Now" name="BtnFind" id="BtnFind"> & nbsp;  ;<INPUT type="button" value="Print" name="BtnFind" id="BtnPrint" onclick="jPrint()">
</TD>
</TR>
<TR>
<TD></TD> </TD>
<TD class="prompt1"> </TD >
</TR>
</TABLE>
</DIV>
<% // end of find div %>
</DIV>
<% // end of mainquery div %>
<DIV id="DivSNPrint" style="display:<%=(sMode== "Print" ) ? "inline" : "none" %>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#66CCFF"> </ td>
<td width="147"><div align="center"><img src="images/logo.gif" width="147" height="30" border="0"></div>
</td>
<td bgcolor="#00CCCC"> </ td>
</tr>
</table>
<p class="Tree1" align="center">SERIAL NUMBER REPORT</p>
<p ><hr></p>
<p class="Tree2">
Neoware Systems, Inc.<br>
400 Feheley Drive<br>
King of Prussia, PA 19406<br>
FAX: (610) 275-5739<br></p>
<P><hr></P>
</DIV>
<DIV id="DivSNFound" style="display:<%=(sMode== "Print" || sMode=="Found" ) ? "inline" : "none" %>">
<%
nTranIndex = 0 ;
nDateIndex = 0 ;
nProductIndex = 0 ;
nSNIndex = 0;
nPrevTranIndex = 0 ;
nPrevDateIndex = 0 ;
nPrevProductIndex = 0 ;
nPrevSNIndex = 0 ;
sPrevTranID = "" ;
sPrevTranDT = "" ;
sPrevProductID = "" ;
sPrevSnID = "" ;
// BEGIN TREE
if (sMode == "Found" || sMode == "Print")
{
while( SqlDataReaderSelTran.Read( ))
{
sTranID = SqlDataReaderSelTran.GetSt ring(0);
sTranDT = SqlDataReaderSelTran.GetDa teTime(1). ToShortDat eString();
sProductID = SqlDataReaderSelTran.GetSt ring(2);
sSnID = SqlDataReaderSelTran.GetSt ring(3);
// TRANSACTION LEVEL
if ( sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID == sPrevProductID )
{
if ( nSNIndex % 4 == 0 )
{
Page.Response.Write ( "</tr><tr>" );
}
Page.Response.Write ( "<td class=\"tree4\" width=25% >"+ sSnID+ "</td>" );
nSNIndex++ ;
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) || (sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID != sPrevProductID ) )
{
// write closing div tags for both Open Serial Numbers Div and Open Product Div
if ( nProductIndex > 0 )
{
// write the closing tags for the serial numbers
while ( nSNIndex % 4 != 0)
{
// finish up the serial number table so it's # of cells per row are consistant
Page.Response.Write ( "<td class=\"tree4\" width=25% > </td>" );
nSNIndex++ ;
}
// write th end of table tag
Page.Response.Write ( "</tr></table></div></div> " );
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
nProductIndex =1 ;
}
else
{
nProductIndex++;
}
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
// write closing div tags for both Open Serial Numbers Div and Open Product Div
if ( nDateIndex > 0 )
{
Page.Response.Write ( "</div>" );
}
if ( sTranID != sPrevTranID )
{
nDateIndex =1 ;
}
else
{
nDateIndex++;
}
}
if ( sTranID != sPrevTranID && nTranIndex > 0 )
{
Page.Response.Write ( "</div>" );
nTranIndex++ ;
}
else
{
nTranIndex = 1;
}
if ( sTranID != sPrevTranID )
{
// write new transaction tags
%>
<br><div class=tree1 id="tran|data|closed|<%=nT ranIndex%> |<%=nDateI ndex%>|<%= nProductIn dex%>|0" style="DISPLAY: none"><div id="tran|image|closed|<%=n TranIndex% >|<%=nDate Index%>|<% =nProductI ndex%>|0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)" >+ </div>
<%=sTranID%>
</div>
<div class=tree1 id="tran|data|opened|<%=nT ranIndex%> |<%=nDateI ndex%>|<%= nProductIn dex%>|0" style="DISPLAY: inline"><div id="tran|image|opened|<%=n TranIndex% >|<%=nDate Index%>|<% =nProductI ndex%>|0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)" >- </div>
<%=sTranID%>
<%
} // end if
// end Transaction table conditions
// Date LEVEL--------------------
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
%>
<br><div id="date|data|closed|<%=nT ranIndex%> |<%=nDateI ndex%>|<%= nProductIn dex%>|0" class="tree2" style="DISPLAY: none"><div id="date|image|closed|<%=n TranIndex% >|<%=nDate Index%>|<% =nProductI ndex%>|0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)">+ </di v>
<%=sTranDT%>
</div>
<div id="date|data|opened|<%=nT ranIndex%> |<%=nDateI ndex%>|<%= nProductIn dex%>|0" class="tree2" style="DISPLAY: inline"><div id="date|image|opened|<%=n TranIndex% >|<%=nDate Index%>|<% =nProductI ndex%>|0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)">- </di v>
<%=sTranDT%>
<%
} // end if
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) || (sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID != sPrevProductID ) )
{
// write new product tags
%>
<br><div id="product|data|closed|<% =nTranInde x%>|<%=nDa teIndex%>| <%=nProduc tIndex%>|0 " class="tree3" style="DISPLAY: none"><div id="product|image|closed|< %=nTranInd ex%>|<%=nD ateIndex%> |<%=nProdu ctIndex%>| 0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)">+ </di v>
<%=sProductID%>
</div>
<div id="product|data|opened|<% =nTranInde x%>|<%=nDa teIndex%>| <%=nProduc tIndex%>|0 " class="tree3" style="DISPLAY: inline"><div id="product|image|opened|< %=nTranInd ex%>|<%=nD ateIndex%> |<%=nProdu ctIndex%>| 0" style="DISPLAY: inline; CURSOR: hand" onclick="jTree(this.id)">- </di v>
<%=sProductID%>
<div id="product|editbutton|ope ned|<%=nTr anIndex%>| <%=nDateIn dex%>|<%=n ProductInd ex%>|0" style="DISPLAY:inline" onclick="jEdit(this.id,'<% =sTranType %>','<%=sT ranID%>',' <%=sTranDT %>','<%=sP roductID%> ')"> <%=(sMode != "Print")?"<IMG alt=\"edit\" src=\"images\\editbutton.g if\">" : "" %></div>
<div class="tree4"><Table cellSpacing="0" cellpadding="2" width="80%" border="1"><tr><td class="tree4" width=25%><%=sSnID%></td>
<%
nSNIndex=1 ;
} // end if
sPrevTranID = sTranID;
sPrevTranDT = sTranDT;
sPrevProductID = sProductID;
sPrevSnID = sSnID;
nPrevTranIndex = nTranIndex;
nPrevDateIndex = nDateIndex;
nPrevProductIndex = nProductIndex;
nPrevSNIndex = nSNIndex;
} // end while
// end SqlDataReaderSelTran while loop
SqlDataReaderSelTran.Close ();
SqlCon1.Close();
if ( nProductIndex > 0 )
{
// write the closing tags for the serial numbers
while ( nSNIndex % 4 != 0)
{
// finish up the serial number table so it's # of cells per row are consistant
Page.Response.Write ( "<td class=\"tree4\" width=25% > </td>" );
nSNIndex++ ;
}
// write the end of table tag
Page.Response.Write ( "</tr></table></div></div> " );
} // end previous nProductIndex write end tag
if ( nDateIndex > 0 )
{
Page.Response.Write ( " </div>" );
} // end previous nDateIndex write end tag
if ( nTranIndex > 0 )
{
Page.Response.Write ( " </div>" );
} // end previous nTranIndex write end tag
// END OF TREE. write closing divs for result and page divs, closing form tag
} // end if
%>
</div>
</DIV>
</form>
</body>
</HTML>
Where do I need to make changes to the attached forms to allow for my serial number entry which I have started to add.
This is off Huge importance and will problably require us going back and forth a few times ...
Attached please find my menu.aspx file as well as my menua.html and NewData.aspx (which is my main file)
Any and all help will be GREATLY APPRECIATED!!!
Menu1a.htm
<script language="JavaScript">
Menu1LastSelected = 'Menu11';
Menu2LastSelected = 'Menu21l1';
function JsFnMenu1Clicked (sClickedId,sURL)
{
var sMenu1 = "Menu1"+sClickedId.substri
var sMenu2LastType = Menu2LastSelected.substrin
var sLastMenu1Eval = "document.all."+ Menu1LastSelected + ".className='Menu1Off'" ;
var sLastMenu2Eval = "document.all."+ Menu2LastSelected + ".className='Menu2Off"+ sMenu2LastType + "'" ;
var sThisMenu1Eval = "document.all."+sMenu1+".c
var sThisMenu2Eval = "document.all."+sClickedId
eval (sLastMenu1Eval);
eval (sLastMenu2Eval);
eval (sThisMenu1Eval);
eval (sThisMenu2Eval);
Menu1LastSelected = sMenu1;
Menu2LastSelected = sClickedId;
window.parent.frames[1].lo
} // end function
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="Menu11" class="Menu1On">Orders<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu21l1" class="Menu2On" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
Order Entry</td>
<td id="Menu21r2" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
Order</td>
<td id="Menu21r3" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
SN</td>
</tr>
</table>
</td>
<td id="Menu12" class="Menu1Off">RMAs<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu22l3" class="Menu2OffLeft" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
RMA Entry</td>
<td id="Menu22r4" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
RMA</td>
</tr>
</table>
</td>
<td id="Menu13" class="Menu1Off">Returns
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td id="Menu23l5" class="Menu2OffLeft" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
Return Entry</td>
<td id="Menu23r6" class="Menu2OffRight" onclick="JsFnMenu1Clicked (this.id,'NewData.aspx?Con
Find/Edit Return</td>
</tr>
</table>
</td>
</tr>
</table>
NewData.aspx
<%@ Page language="c#" Codebehind="NewData.aspx.c
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Create <%=sTranType%> Entry </title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="nsn.css" type="text/css" rel="stylesheet">
<script language="Javascript">
var aValue ;
var bEscapeKeyMode = false ;
function jKeypress(sID, sMode)
{
//HLS Test 8/18/2003
//alert ("IN: jKeypress");
var bReturn = true;
var skey = event.keycode ;
skey = window.event.keyCode ;
if (bEscapeKeyMode == true)
{
if (substring(sID,0,4) == "TxtSN")
{
alert ( "in text sn field" );
}
}
if (skey == 92)
{
bEscapeKeyMode = true ;
}
else
{
if (skey == 32 && (sMode == "Create" || sMode=="Edit") )
{
bReturn = false;
switch (sID)
{
case "TxtTranID":
document.all.TxtProductID.
if (sMode == "Create" )
{
document.all.TxtProductID.
}
break;
case "TxtProductID":
document.all.TxtAreaSN.foc
if (sMode == "Create" )
{
document.all.TxtAreaSN.val
}
break;
default:
break;
}
bEscapeKeyMode = false ;
}
else
{
bEscapeKeyMode = false ;
}
}
if (!bReturn)
{
window.event.returnvalue = false ;
}
return (bReturn)
}
function SNInputClear()
{
//HLS Test 8/18/2003
//alert ("IN: SNInputClear");
document.all.TxtAreaSN.val
}
function jPrint ()
{
//HLS Test 8/18/2003
//alert ("IN: jPrint");
var sTranID = document.all.TxtTranID.val
var sDateChoice = document.forms[0].rdoTranD
if (sDateChoice != "Now" )
{
// get other date from 3 seperate HTML form elements
sTranDay = document.all.selTranDTDay;
sTranMo = document.all.selTranDTMont
sTranYr = document.all.selTranDTYear
sTranDT = sTranMo + "/" + sTranDay + "/" + sTranYr;
}
else
{
d = new Date();
sTranDT = "";
sTranDT += (d.getMonth() + 1) + "/";
sTranDT += d.getDate() + "/";
sTranDT += d.getYear();
}
sURL = "NewData.aspx?Context=<%=s
window.open(sURL) ;
}
function SNInputEditChange (sValue, nIndex )
{
// fires when a user corrrects a single SN
//the change is stored back into the array of SNs
//HLS Test 8/18/2003
//alert ("IN: SNInputEditChange");
aValue[nIndex] = sValue ;
document.all.TxtAreaSN.val
//HLS Test 8/19/2003
SNInputCheck();
}
function jTree (sDivID)
{
//HLS Test 8/18/2003
//alert ("IN: jTree");
sDelim = "|" ;
aValue = sDivID.split ( "|") ;
sLevel = aValue[0];
sType = aValue[1];
sOpenedOrClosed = aValue[2];
sIndex = aValue[3] + sDelim + aValue[4] + sDelim + aValue[5] + sDelim + aValue[6] ;
sDiv = sLevel + sDelim + "data" + sDelim + "closed" + sDelim + sIndex ;
oDiv = document.getElementById ( sDiv) ;
oDiv.style.display = sOpenedOrClosed == "closed" ? "none" : "inline" ;
sDiv = sLevel + sDelim + "data" + sDelim + "opened" + sDelim + sIndex ;
oDiv = document.getElementById ( sDiv) ;
oDiv.style.display = sOpenedOrClosed == "closed" ? "inline" : "none" ;
}
function SNInputEditAll()
{
//HLS Test 8/18/2003
//alert ("IN: SNInputEditAll");
document.all.DivSNCheckInv
document.all.DivSNCheckVal
document.all.DivSN.style.d
document.all.DivSNInput.st
document.all.TxtAreaSN.val
}
function ProductAdd()
{
//HLS Test 8/18/2003
//alert ("IN: ProductAdd");
document.all.DivSNCheckInv
document.all.DivSNCheckVal
document.all.DivSN.style.d
document.all.DivSNInput.st
document.all.TxtProductID.
}
function jEdit (sID, sTranType, sTranID, sTranDT, sProductID)
{
//HLS Test 8/18/2003
//alert ("IN: jEdit");
//sUrl = "NewData.aspx?Mode=Edit&Tr
sUrl = "NewData.aspx?Mode=Edit&Co
//alert ("IN: jEdit::" + sUrl);
//alert ("Context = " + sTranType);
window.location = sUrl;
}
function jOnChange(sID, sMode)
{
//HLS Test 8/18/2003
//alert ("IN: jOnChange");
if (sMode == "Create" || sMode=="Edit" )
{
var oID = document.getElementById(sI
var sText = oID.value;
sText = sText.replace ( " " , "" );
oID.value = sText ;
if ( sID == "TxtTranID")
{
document.all.TxtProductID.
}
if (document.all.DivSNInput.s
{
if ( sID == "TxtProductID")
{
document.all.TxtAreaSN.foc
}
}
}
if (sMode == "Find" || sMode == "Found" || sMode == "Print")
{
// document.all.BtnFind.focus
}
}
function jOnLoad()
{
//HLS Test 8/18/2003
sMode = "<%=sMode%>";
sTranID = "<%=sTranID%>";
sValue = '<%=sbAreaSns%>';
sNwSN = "<%=sNwSN%>;
if (sMode == "Print")
{
return (true);
}
if (sMode == "Create" && sTranID != "")
{
document.all.TxtProductID.
}
else
{
document.all.TxtTranID.foc
}
if (sMode == "Edit")
{
document.all.TxtAreaSN.val
return (true);
}
}
function SNInputCheck()
{
// convert SN Input field to an Array of individual SNs based on InputDelimiter selected,
// and present back to the user for validation within separate HTML form input elements.
// strategy is to use the InnerHTML property of an HTML div tag to dynamically re-render
// data without round trips to the server
//HLS Test 8/18/2003
//alert ("IN: SNInputCheck");
var sInputDelimiter = " ";
// get the data from the unformatted SN data input Form
var sValue = document.all.TxtAreaSN.val
// convert the data into an array of SNs.based on input delimiter.
aValue = sValue.split (sInputDelimiter) ;
aValue.sort();
// uncomment the following three lines to debug the initial Input form data
//var sOutputDelimiter = "|";
//var sDelimitedValue = aValue.join (sOutputDelimiter);
alert (sDelimitedValue);
var sHtml = "";
var nIndex= 0;
var nValidCount = 0 ;
// Count of duplicates
var nDuplicateCount = 0;
// Flag if there is a duplicate
var bDuplicateInstance = false ;
if (sValue.length == 0 )
{
alert ( "No Serial Numbers have been entered. Please enter a serial number");
nCount = 0 ;
return (0);
}
// create a validated string first that strips out all doubles of delimiters and trailing delimiters
var sValidValue = "";
nCount = aValue.length ;
// strip out doubles of delimiters (e.g. spaces, if that's the delimiter)
for (nIndex = 0; nIndex < nCount; nIndex++)
{
if (aValue[nIndex] != sInputDelimiter && aValue[nIndex] != "" )
{
sValidValue = sValidValue+aValue[nIndex]
}
}
// chop off trailing delimiter
sValidValue = sValidValue.substring (0, sValidValue.length-1);
// alert (sValidValue);
// now create the array of values
aValue = sValidValue.split ( sInputDelimiter ) ;
nCount = aValue.length ;
// alert ( nCount ) ;
for (nIndex = 0; nIndex < nCount; nIndex++)
{
// check for duplicates
bDuplicateInstance = false ;
// check if the next SN is a duplicate
if (nIndex > 0)
{
if (aValue[nIndex] == aValue[nIndex-1] )
{
bDuplicateInstance = true ;
}
}
if (nIndex < (nCount + 1))
{
if (aValue[nIndex] == aValue[nIndex+1] )
{
bDuplicateInstance = true ;
}
}
// end duplicate if
// set the style to be rendered as a string to be added into the dynamic HTML'
sStyle = bDuplicateInstance ? "SNInputDuplicate" : "SNInputOK" ;
// format the dynamic HTML
sHtml = sHtml + "<input id='TxtSn"+nIndex + "' value= '" + aValue[nIndex] + "' class=" + sStyle + " onChange='SNInputEditChang
// add a new line after every 5 SNs.
nValidCount++ ;
if (nValidCount % 5 == 0 )
{
sHtml= sHtml+ "<br>";
}
if ( bDuplicateInstance)
{
nDuplicateCount++ ;
}
}
// END OF FOR LOOP
// render the dynamic HTML ;
/// ggalert ( sHtml)
// Show Validation layer if user action is required prior to submit
if ( nDuplicateCount > 0)
{
document.all.DivSNCheckVal
document.all.DivSNCheckInv
document.all.DivSNCountInv
}
// Show Submit layer if validation passed
else
{
document.all.DivSNCheckVal
document.all.DivSNCheckInv
document.all.DivSNCountVal
}
document.all.DivSN.style.d
document.all.DivSNInput.st
document.all.DivSN.innerHT
document.all.TxtAreaSN.val
// END OF FUNCTION
}
</script>
</HEAD>
<body onload="jOnLoad(); ">
<form id="Form1" method="post" runat="server">
<DIV id="DivPage" style="Z-INDEX: 3; LEFT: 8px; WIDTH: 798px; POSITION: absolute; TOP: 8px; HEIGHT: 221px">
<DIV id="DivMainQuery" style="display:<%=(sMode==
<TABLE id="TblContextPrompt" cellSpacing="0" width="98%" border="0">
<TR>
<TD width="99%" align="left"><FONT face="Eras Bold ITC" color="#000066" size="5"><%=sMode + " "+ sTranType+ " Entry"%></FONT>
</TD>
</TR>
</TABLE>
<TABLE id="TblOrderNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"> </TD>
<TD class="prompt1" align="left" width="16%"><%=sTranType%>
<TD class="prompt1"><INPUT value="<%=sTranID%>" type="text" maxLength="50" size="30" name="TxtTranID" id="TxtTranID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" align="left"><%=sTranTypeD
<%
%>
<TD class="prompt1"><INPUT type="radio" <%=(bNow ? "CHECKED" : "") %> value="Now" name="rdoTranDT" id="rdoTranDTNow"><%="Toda
<div id="DivSelectOtherMonth" style="display:inline" ><%=sBuildHtmlSelectOtherD
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
<SELECT name="selTranDTYear" id ="selTranDTYear">
<% for (nIndex = (DtOther.Year-1); nIndex <= (DtOther.Year + 10) ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Year ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
</TD>
</TR>
</TABLE>
<div id="DivProduct" style="display:<%=(sMode==
<TABLE id="TblProductNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"></TD>
<TD class="prompt1" align="right" width="16%"></TD>
<TD class="prompt1"></TD>
</TR>
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%">
</TD>
<TD class="prompt1" align="left" width="16%">Product Number: </TD>
<TD class="prompt1"><INPUT value="<%=sProductID%>" type="text" id="TxtProductID" maxLength="50" size="30" name="TxtProductID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i
</TD>
</TR>
</TABLE>
</div>
<!-- Mike added code 2004.03.16-->
<TABLE id="TblSerialNumber" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%"> </TD>
<TD class="prompt1" align="left" width="16%"><%=sTranType%>
<TD class="prompt1"><INPUT value="<%=sNwSN%>" type="text" maxLength="50" size="30" name="TxtTranID" id="TxtTranID" onkeypress="return jKeypress(this.id, '<%=sMode%>')" onchange="jOnChange(this.i
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" align="left"><%=sTranTypeD
<%
%>
<TD class="prompt1"><INPUT type="radio" <%=(bNow ? "CHECKED" : "") %> value="Now" name="rdoTranDT" id="rdoTranDTNow"><%="Toda
<div id="DivSelectOtherMonth" style="display:inline" ><%=sBuildHtmlSelectOtherD
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
<SELECT name="selTranDTYear" id ="selTranDTYear">
<% for (nIndex = (DtOther.Year-1); nIndex <= (DtOther.Year + 10) ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Year ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
</TD>
</TR>
</TABLE>
<DIV id="DivSNAddEdit" style="display:<%=(sMode==
<DIV id="DivSNInput" >
<TABLE id="TblSNPrompt" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="2%">
</TD>
<TD class="prompt1" align="left" width="16%">Serial Number(s): </TD>
<TD class="prompt1">Please scan or key Serial Numbers into the space below.
</TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1"> </TD
<TD class="prompt1" align="left"></TD>
</TR>
<TR>
<TD></TD>
<TD class="prompt1" colSpan="2"><INPUT onclick="SNInputCheck()" type="button" align="left" value="Submit Serial Numbers" name="BtnSNInpuCheck">
<INPUT onclick="SNInputClear()" type="button" align="left" value=" Clear Serial Numbers " name="BtnSNInputClear"></T
</TR>
<TR>
<TD></TD>
<TD class="prompt1" colSpan="2"> </TD>
</TR>
<TR>
<TD> </TD>
<TD class="prompt1" colSpan="2"><TEXTAREA style="WIDTH: 100%" name="TxtAreaSN" rows="10" cols="20" accessKey="TxtAreaSN" ></TEXTAREA></TD>
</TR>
</TABLE>
</DIV>
<DIV id="DivSNCheckInvalid" style="DISPLAY: none">
<TABLE id="TblSNCheck2" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%"></TD>
<TD width="16%" class="prompt1" align="left">Serial Number(s):</TD>
<TD class="prompt2" align="left"><B><FONT color="#ff0000"><DIV id="DivSNCountInvalid" align="left" style="DISPLAY:inline">&nb
</FONT></B>
</TD>
</TR>
</TABLE>
<TABLE id="TblSNValidate1" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1">
<INPUT onclick="SNInputCheck()" type="button" value="Re-Submit Serial Numbers" name="BtnSNInputAddProduct
<INPUT onClick="SNInputEditAll()"
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1"> </TD
</TR>
</TABLE>
</DIV>
<DIV id="DivSNCheckValid" style="DISPLAY: none">
<TABLE id="TblSNCheck" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%"></TD>
<TD width="16%" class="prompt1" align="left">Serial Number(s):</TD>
<TD class="prompt2" align="left"><B><FONT color="#ff0000"><DIV id="DivSNCountValid" align="left" style="DISPLAY:inline">&nb
</FONT></B> Serial Number(s) have been entered.
</TD>
</TR>
</TABLE>
<TABLE id="TblSNSaveMenu" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD> </TD>
<TD colspan="2" align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1">
<% if (sMode != "Edit") { %><INPUT runat="server" type="button" value="Add another Product" name="BtnAddProduct " id="BtnAddProduct"> &
<INPUT runat="server" type="button" value="Complete" name="BtnCompleteTransacti
</TD>
</TR>
<TR>
<TD height="21" style="WIDTH: 21px"> </TD>
<TD class="prompt1"> </TD
</TR>
</TABLE>
</DIV>
<TABLE id="TblSNDivMenu" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD width="2%" height="21"> </TD>
<TD><DIV id="DivSN"></DIV>
<DIV></DIV>
</TD>
</TR>
</TABLE>
</DIV>
<DIV id="DivSNFind" style="display:<%=(sMode==
<TABLE id="TblFind" cellSpacing="0" width="100%" border="0" cellpadding="0">
<TR>
<TD width="2%" height="21"> </TD>
<TD align="left" class="prompt1"><hr>
</TD>
</TR>
<TR>
<TD width="2%" height="21"> </TD>
<TD class="prompt1"><INPUT runat="server" type="button" value="Find Now" name="BtnFind" id="BtnFind"> &
</TD>
</TR>
<TR>
<TD></TD> </TD>
<TD class="prompt1"> </TD
</TR>
</TABLE>
</DIV>
<% // end of find div %>
</DIV>
<% // end of mainquery div %>
<DIV id="DivSNPrint" style="display:<%=(sMode==
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#66CCFF"> </
<td width="147"><div align="center"><img src="images/logo.gif" width="147" height="30" border="0"></div>
</td>
<td bgcolor="#00CCCC"> </
</tr>
</table>
<p class="Tree1" align="center">SERIAL NUMBER REPORT</p>
<p ><hr></p>
<p class="Tree2">
Neoware Systems, Inc.<br>
400 Feheley Drive<br>
King of Prussia, PA 19406<br>
FAX: (610) 275-5739<br></p>
<P><hr></P>
</DIV>
<DIV id="DivSNFound" style="display:<%=(sMode==
<%
nTranIndex = 0 ;
nDateIndex = 0 ;
nProductIndex = 0 ;
nSNIndex = 0;
nPrevTranIndex = 0 ;
nPrevDateIndex = 0 ;
nPrevProductIndex = 0 ;
nPrevSNIndex = 0 ;
sPrevTranID = "" ;
sPrevTranDT = "" ;
sPrevProductID = "" ;
sPrevSnID = "" ;
// BEGIN TREE
if (sMode == "Found" || sMode == "Print")
{
while( SqlDataReaderSelTran.Read(
{
sTranID = SqlDataReaderSelTran.GetSt
sTranDT = SqlDataReaderSelTran.GetDa
sProductID = SqlDataReaderSelTran.GetSt
sSnID = SqlDataReaderSelTran.GetSt
// TRANSACTION LEVEL
if ( sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID == sPrevProductID )
{
if ( nSNIndex % 4 == 0 )
{
Page.Response.Write ( "</tr><tr>" );
}
Page.Response.Write ( "<td class=\"tree4\" width=25% >"+ sSnID+ "</td>" );
nSNIndex++ ;
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) || (sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID != sPrevProductID ) )
{
// write closing div tags for both Open Serial Numbers Div and Open Product Div
if ( nProductIndex > 0 )
{
// write the closing tags for the serial numbers
while ( nSNIndex % 4 != 0)
{
// finish up the serial number table so it's # of cells per row are consistant
Page.Response.Write ( "<td class=\"tree4\" width=25% > </td>" );
nSNIndex++ ;
}
// write th end of table tag
Page.Response.Write ( "</tr></table></div></div>
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
nProductIndex =1 ;
}
else
{
nProductIndex++;
}
}
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
// write closing div tags for both Open Serial Numbers Div and Open Product Div
if ( nDateIndex > 0 )
{
Page.Response.Write ( "</div>" );
}
if ( sTranID != sPrevTranID )
{
nDateIndex =1 ;
}
else
{
nDateIndex++;
}
}
if ( sTranID != sPrevTranID && nTranIndex > 0 )
{
Page.Response.Write ( "</div>" );
nTranIndex++ ;
}
else
{
nTranIndex = 1;
}
if ( sTranID != sPrevTranID )
{
// write new transaction tags
%>
<br><div class=tree1 id="tran|data|closed|<%=nT
<%=sTranID%>
</div>
<div class=tree1 id="tran|data|opened|<%=nT
<%=sTranID%>
<%
} // end if
// end Transaction table conditions
// Date LEVEL--------------------
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) )
{
%>
<br><div id="date|data|closed|<%=nT
<%=sTranDT%>
</div>
<div id="date|data|opened|<%=nT
<%=sTranDT%>
<%
} // end if
if ( sTranID != sPrevTranID || (sTranID == sPrevTranID && sTranDT != sPrevTranDT) || (sTranID == sPrevTranID && sTranDT == sPrevTranDT && sProductID != sPrevProductID ) )
{
// write new product tags
%>
<br><div id="product|data|closed|<%
<%=sProductID%>
</div>
<div id="product|data|opened|<%
<%=sProductID%>
<div id="product|editbutton|ope
<div class="tree4"><Table cellSpacing="0" cellpadding="2" width="80%" border="1"><tr><td class="tree4" width=25%><%=sSnID%></td>
<%
nSNIndex=1 ;
} // end if
sPrevTranID = sTranID;
sPrevTranDT = sTranDT;
sPrevProductID = sProductID;
sPrevSnID = sSnID;
nPrevTranIndex = nTranIndex;
nPrevDateIndex = nDateIndex;
nPrevProductIndex = nProductIndex;
nPrevSNIndex = nSNIndex;
} // end while
// end SqlDataReaderSelTran while loop
SqlDataReaderSelTran.Close
SqlCon1.Close();
if ( nProductIndex > 0 )
{
// write the closing tags for the serial numbers
while ( nSNIndex % 4 != 0)
{
// finish up the serial number table so it's # of cells per row are consistant
Page.Response.Write ( "<td class=\"tree4\" width=25% > </td>" );
nSNIndex++ ;
}
// write the end of table tag
Page.Response.Write ( "</tr></table></div></div>
} // end previous nProductIndex write end tag
if ( nDateIndex > 0 )
{
Page.Response.Write ( " </div>" );
} // end previous nDateIndex write end tag
if ( nTranIndex > 0 )
{
Page.Response.Write ( " </div>" );
} // end previous nTranIndex write end tag
// END OF TREE. write closing divs for result and page divs, closing form tag
} // end if
%>
</div>
</DIV>
</form>
</body>
</HTML>
mrissi, this is classic ASP coding style and is to be avoided like the plague in ASP.NET
stuff such as this:
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
is totally an abuse IMHO of ASP.NET:
in the aspx page:
<asp:DropDownList id="TransactionDayList" runat="server" />
you could have done better in the aspx.cs like so
private void Page_Load(object sender, EventArgs e)
{
if (! Page.IsPostBack)
{
PopulateControls();
}
}
/// entry point to populate controls
private void PopulateControls()
{
PopulateListControlByNumbe r(Transact ionDayList .Items,1,3 2);
}
private void PopulateListControlByNumbe rs(ListIte mCollectio n items,int start,int end)
{
for(int i=start,i<end;i++)
{
ListItem item = new ListItem(i.ToString(),i.To String());
items.Add(item);
}
}
private void SetSingularListItem(ListCo ntrol listControl,string value)
{
listControl.SelectedIndex = -1;
ListItem listItem = listControl.Items.FindByVa lue(value) ;
if (listItem != null)
{
listItem.Selected = true;
}
}
stuff such as this:
<SELECT name="selTranDTDay" id ="selTranDTDay">
<% for (nIndex = 1; nIndex <=31 ; nIndex++)
{
%>
<OPTION value="<%=nIndex%>" <%=(nIndex == DtOther.Day ? "selected" : "") %>><%=nIndex%></OPTION>
<%
}
%>
</SELECT>
is totally an abuse IMHO of ASP.NET:
in the aspx page:
<asp:DropDownList id="TransactionDayList" runat="server" />
you could have done better in the aspx.cs like so
private void Page_Load(object sender, EventArgs e)
{
if (! Page.IsPostBack)
{
PopulateControls();
}
}
/// entry point to populate controls
private void PopulateControls()
{
PopulateListControlByNumbe
}
private void PopulateListControlByNumbe
{
for(int i=start,i<end;i++)
{
ListItem item = new ListItem(i.ToString(),i.To
items.Add(item);
}
}
private void SetSingularListItem(ListCo
{
listControl.SelectedIndex = -1;
ListItem listItem = listControl.Items.FindByVa
if (listItem != null)
{
listItem.Selected = true;
}
}
/// entry point to populate controls
private void PopulateControls()
{
PopulateListControlByNumbe r(Transact ionDayList .Items,1,3 2);
SetSingularListItem(Transa ctionDayLi st,"15");
/// other stuff
}
you must think in terms of controls instead of the traditional code-everywhere-like-spagh etti ASP style.
private void PopulateControls()
{
PopulateListControlByNumbe
SetSingularListItem(Transa
/// other stuff
}
you must think in terms of controls instead of the traditional code-everywhere-like-spagh
ASKER
ok -- so I should basically start over, huh?
Thanks for your help!
Thanks for your help!
yes, that would really be in your best interests.
ASKER
Any books or resources that you can recommend as a starting place for C#?
Beginning ASP.NET Using C#
From Wrox.
http://www.wrox.com
also, any books on ASP.NET & C# from Microsoft Press would strengthen your expertise.
From Wrox.
http://www.wrox.com
also, any books on ASP.NET & C# from Microsoft Press would strengthen your expertise.
ASKER
Cool, Thanks -- I do appreciate your help .... Back to the drawing board.
MJR
MJR
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
We use XML in a few of our other custom internal apps. I was trying teach myself C#.
Just as a guide -- is there anywhere you recommend I should start?
Just as a guide -- is there anywhere you recommend I should start?
ASKER
It would be great if you could move it! Thanks!
MJR