Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help converting .asp page to .aspx.

Status
Not open for further replies.

joejack0330

Technical User
Jan 27, 2006
95
US
We currently load an .asp page with data from our sql server and have text box where users can enter qty next to each item them would like to order then hit submit button and sends that data to sql and loads our system. We are looking to convert this to .aspx page and not sure where to start. We have used datagrids to display sql data and that works fine but not sure if we should use for this or not and how to add a textbox to the datagrid. This is our current code:
------------------------------------------
<HTML>
<HEAD>
<title>Sales Ad Program</title>
<link rel="stylesheet" type="text/css" href="StyleBlue.css">
<meta name="Microsoft Border" content="none, default">
</HEAD>

<body>

<%
AdPageDate = FormatDateTime(cdate(Trim(Request("ID2"))))
%>

<SCRIPT LANGUAGE="JavaScript">
<!-- This script will check form fields for numeric values -->
<!-- Begin
function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
var numberfield = objName;
if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
{
numberfield.select();
numberfield.focus();
return false;
}
else
{
return true;
}
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";

for (i = 0; i < checkStr.value.length; i++)
{
ch = checkStr.value.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alertsay = "Please enter only these values \""
alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}

// set the minimum and maximum
var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
{
alertsay = "Please enter a value greater than or "
alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
}
// End -->
</script>

<!--#include file="IncludeSecurity.asp"-->
<!--#include file="IncludeSQLServer4Connection.asp"-->
<!--#include file="IncludeCustomerNameAndAddress.asp"-->

<p>

<b <%
Dim Parm1, Parm2, Parm3
Parm1 = Trim(Request("ID1"))
Parm2 = Trim(Request("ID2"))
Parm3 = Trim(Request("ID3"))

MySQL= "spWebSalesProgramGroceryOrder @HeadQuartersCustomer='" & Session("HeadQuartersCustomer") &_
"', @SelectedCustomer='" & Session("SelectedCustomer") &_
"', @HeadQuarters =" & Session("HEADQUARTERS") &_
", @GroupAdID=" & Parm3%>><font size="2"><% response.write Parm1 %><B> </B><% response.write Parm2 %></b>

<%
dim conntemp, rstemp, Service
set conntemp=server.createobject("adodb.connection")
conntemp.open strconn
set rstemp=conntemp.execute(MySQL)
howmanyfields=rstemp.fields.count -1%>

<table width="100%" border=0>
<tr>
<% 'Put Headings On The Table of Field Names
%>
<td id="Heading" nowrap>Qty</td>
<%
for i=0 to howmanyfields %>
<td id="Heading" nowrap><%=rstemp(i).name%></td>
<% next %>

</tr>
<% ' Now lets grab all the records
qty = 1
do while not rstemp.eof %>
<tr>

<FORM METHOD=POST ACTION=SendQTYsToServer3.asp>

<input name=ItemNum<%=qty%> type="hidden" value="<%=rstemp(2)%>">
<input name=ListPrice<%=qty%> type="hidden" value="<%=rstemp(6)%>">
<td id="Detail" width="24%" height="25" align="left"> <INPUT NAME=Quantity<%=qty%> onBlur="checkNumeric(this,0,999,'','','');" maxlength="3" size="2" value="0"></td>

<% for i = 0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue=" "
end if%>

<% If rstemp(7) = 2 Then Service = (CDbl(rstemp(9)) * CDbl(rstemp(6))) Else Service = (CDbl(rstemp(9)) * CDbl(rstemp(8))) End If%>
<%If i = 1 then%>
<td id="DetailImage"><a href="/images/items/<%=thisvalue%>" target="_blank"><img border="0" src="/images/items_tn/tn_<%=thisvalue%>" ></a></td>
<% ElseIf i = 2 then %>
<td id="DetailLink"><a href="SalesAdProgramPastOrders.asp?id1=<% response.write thisvalue%>&id2=<% response.write "01"%>" target="_blank" ><%=thisvalue%></a></td>
<% ElseIf i = 6 then %>
<td align="Right" id="Detail" nowrap><%=FormatCurrency(thisvalue)%></td>
<% ElseIf i = 7 then %>
<td align="Right" id="Detail" nowrap><%=FormatCurrency(CDbl(rstemp(6)) - CDbl(rstemp(8)))%></td>
<% ElseIf i = 8 then %>
<td align="Right" id="Detail" nowrap><%=FormatCurrency(thisvalue)%></td>
<% ElseIf i = 9 then %>
<td align="Right" id="Detail" nowrap><%= FormatCurrency((CDbl(Service) + CDbl(rstemp(8))) / CDbl(rstemp(4)))%></td>
<% ElseIf i = 12 then %>
<td align="Right" id="Detail" nowrap><%= FormatPercent(FormatNumber( (CDbl(thisvalue) - ((CDbl(Service) + CDbl(rstemp(8))) / CDbl(rstemp(4)))),2) / CDbl(thisvalue))%></td>
<% Else %>
<td id="Detail" nowrap><%=thisvalue%></td>
<% End If %>

<% next %>

</tr>

<%
qty = qty + 1
rstemp.movenext
loop%>
</table>

<%Session("RecCount") = qty %>

*Order to be attached to the first order you place on or after this date*
<select name=OrderDeliverDate>

<% for l = 0 to 13 %>
<option value="<%= FormatDateTime(cdate(AdPageDate) - 6 + l)%>"><%= FormatDateTime(cdate(AdPageDate) - 6 + l ,1)%>
<% next %>
</select>

<p>

<input name=Facility type="hidden" value="01">
<input name=AdDate type="hidden" value="<%= FormatDateTime(cdate(AdPageDate))%>">

<td width="64%" height="21" align="left"><INPUT NAME=SUBMIT TYPE=SUBMIT VALUE=SUBMIT>
<p>

<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>

</body>
---------------------------------------------

See attachment for how screen currently displays.

Looking for a little help getting started in the correct direction. Thanks, Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top