wilkersons
asked on
Getting syntax error : trying to pass a variable in location.href
I am using ASP.Net. I am trying to pass to variables tp the location.href. I am getting syntax error at
location.href='frmCreditLi mit.aspx?C ustID='& strCustID&(......
Please help!!
Dim strmessage As String
Dim strCustID As String
strCustID = "C000029"
strSiteID='"R000010"
strmessage = "Our records indicate that we have not received your weekly payment. Please send your weekly payment check. If payment has been sent please ignore this message."
Dim strScript As String = "<script language=JavaScript>"
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='& strCustID&(???? HOW DO I PASS THE SECOND PARAMETER SITEID ) ;}"
strScript += "</script>"
If (Not Page.IsStartupScriptRegist ered("clie ntScript") ) Then
Page.RegisterStartupScript ("clientSc ript", strScript)
End If
End If
location.href='frmCreditLi
Please help!!
Dim strmessage As String
Dim strCustID As String
strCustID = "C000029"
strSiteID='"R000010"
strmessage = "Our records indicate that we have not received your weekly payment. Please send your weekly payment check. If payment has been sent please ignore this message."
Dim strScript As String = "<script language=JavaScript>"
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
strScript += "</script>"
If (Not Page.IsStartupScriptRegist
Page.RegisterStartupScript
End If
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
typo
shud be
location.href='frmCreditLi mit.aspx?C ustID='+& strCustID&+'&&SiteID='+& strSiteID&
shud be
location.href='frmCreditLi
ASKER
Still getting syntax error
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='+& strCustID&+'&&SiteID='+& strSiteID& ;}"
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
ASKER
View Source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>TJR Online: Enter Items</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri pt">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout ">
<form name="Form1" method="post" action="frmSale.aspx?SiteI D=R000010& amp;SaleTy pe=Reorder &CustI D=C000013& amp;Term=1 4&OrdN br=0101352 005121731& amp;Custna me=Krauthe im%20Jewel ry%20Inc." id="Form1">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwtNjE4Mzg1NzE3O3Q 8O2w8aTwxP js+O2w8dDw 7bDxpPDE+O 2k8OD47aTw 5Pjs+O2w8d DxwPHA8bDx UZXh0Oz47b DxFbnRlciB TYWxlcyBTY 3JlZW4gZm9 yIFIwMDAwM TA7Pj47Pjs 7Pjt0PDtsP Gk8MT47aTw zPjtpPDc+O 2k8MTE+O2k 8MTM+O2k8M Tc+O2k8MTk +Oz47bDx0P HA8cDxsPFR leHQ7PjtsP FNhbGUgVHl wZTogTmV3I FJlb3JkZXI gMDEwMTM1M jAwNTEyMTc zMSBmb3IgQ zAwMDAxMyB LcmF1dGhla W0gSmV3ZWx yeSBJbmMuO z4+Oz47Oz4 7dDxwPHA8b DxUZXh0Oz4 7bDxUZXJtO iAxNCAgICA gICAgQ3JlZ Gl0IExpbWl 0OiQ0LDAwM C4wMDs+Pjs +Ozs+O3Q8c DxwPGw8VGV 4dDs+O2w8X GU7Pj47Pjs 7Pjt0PHA8c DxsPFRleHQ 7PjtsPFxlO z4+Oz47Oz4 7dDxAMDxwP HA8bDxQYWd lQ291bnQ7X yFJdGVtQ29 1bnQ7XyFEY XRhU291cmN lSXRlbUNvd W50O0RhdGF LZXlzOz47b DxpPDE+O2k 8MD47aTwwP jtsPD47Pj4 7Pjs7Ozs7O zs7Ozs+O2w 8aTwwPjs+O 2w8dDw7bDx pPDE+Oz47b Dx0PDtsPGk 8Mz47aTw0P jtpPDU+Oz4 7bDx0PHA8c DxsPFRleHQ 7PjtsPDA7P j47Pjs7Pjt 0PHA8cDxsP FRleHQ7Pjt sPCQwLjAwO z4+Oz47Oz4 7dDxwPHA8b DxUZXh0Oz4 7bDwkMC4wM Ds+Pjs+Ozs +Oz4+Oz4+O z4+O3Q8cDw 7cDxsPG9uY 2xpY2s7Pjt sPHJldHVyb iBjb25maXJ tKCdBcmUge W91IHN1cmU geW91IHdhb nQgdG8gUG9 zdCBEYXRhP ycpXDs7Pj4 +Ozs+O3Q8c Dw7cDxsPG9 uY2xpY2s7P jtsPHJldHV ybiBjb25ma XJtKCdBcmU geW91IHN1c mUgeW91IHd hbnQgdG8gY 2FuY2VsJyl cOzs+Pj47O z47Pj47dDx wPDtwPGw8V mFsdWU7Pjt sPDA7Pj4+O zs+Oz4+Oz4 +Oz65kRy8e n5DwcwbH7U BjJfwAxiZb A==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName. toLowerCas e().indexO f("netscap e") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.valu e = eventTarget.split("$").joi n(":");
theform.__EVENTARGUMENT.va lue = eventArgument;
theform.submit();
}
// -->
</script>
<span id="LblReportCaption" style="color:DarkRed;font- family:Ari al;font-si ze:Medium; font-weigh t:bold;hei ght:24px;w idth:396px ;Z-INDEX: 108; LEFT: 246px; POSITION: absolute; TOP: 65px">Enter Sales Screen for R000010</span><a id="lnkSignOff" href="javascript:__doPostB ack('lnkSi gnOff','') " style="font-family:Arial;f ont-size:X -Small;hei ght:16px;w idth:52px; Z-INDEX: 107; LEFT: 784px; POSITION: absolute; TOP: 40px">Sign Off</a><span id="lblRSMOnline" style="color:DarkRed;font- family:Ari al;font-si ze:Large;f ont-weight :bold;heig ht:24px;wi dth:396px; Z-INDEX: 106; LEFT: 248px; POSITION: absolute; TOP: 24px">TJR Online</span><a id="lnkContactUs" href="javascript:__doPostB ack('lnkCo ntactUs',' ')" style="font-family:Arial;f ont-size:X -Small;hei ght:16px;w idth:72px; Z-INDEX: 105; LEFT: 704px; POSITION: absolute; TOP: 40px">Contact Us</a><img id="imgLogo" src="images\WALogo.jpg" border="0" style="height:92px;width:2 20px;Z-IND EX: 101; LEFT: 16px; POSITION: absolute; TOP: 8px" />
<HR style="Z-INDEX: 102; LEFT: 12px; WIDTH: 99.95%; POSITION: absolute; TOP: 100px; HEIGHT: 1px"
width="99.95%" color="#663333" SIZE="1">
<HR style="Z-INDEX: 103; LEFT: 235px; WIDTH: 76.47%; POSITION: absolute; TOP: 59px; HEIGHT: 1px"
width="76.47%" color="#663333" SIZE="1">
<a id="lnkHome" href="javascript:__doPostB ack('lnkHo me','')" style="font-family:Arial;f ont-size:X -Small;hei ght:16px;w idth:36px; Z-INDEX: 104; LEFT: 656px; POSITION: absolute; TOP: 40px">Home</a><div id="pnlSaletype" style="background-color:Wh ite;border -color:Dar kRed;borde r-width:1p x;border-s tyle:Solid ;height:41 9px;width: 624px;Z-IN DEX: 109; LEFT: 16px; POSITION: absolute; TOP: 152px">
<P style="FONT-SIZE: medium; COLOR: #720000; FONT-FAMILY: Arial">Please enter the
Items.</P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblSaleType" style="color:DarkRed;font- family:Ari al;font-si ze:X-Small ;font-weig ht:bold;he ight:24px; width:624p x;">Sale Type: New Reorder 0101352005121731 for C000013 Krautheim Jewelry Inc.</span></P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblTerm" style="color:DarkRed;font- family:Ari al;font-si ze:X-Small ;font-weig ht:bold;he ight:24px; width:192p x;">Term: 14 Credit Limit:$4,000.00</span></P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="Label1" style="color:DarkRed;font- family:Ari al;font-si ze:X-Small ;font-weig ht:bold;he ight:24px; width:144p x;">Please scan the Item</span>
<input name="txtItem" type="text" id="txtItem" tabindex="1" style="TEXT-TRANSFORM: uppercase" />
<input type="submit" name="cmdSale" value="Enter Sale" id="cmdSale" style="width:80px;" /></P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblErrorMsg" style="color:Red;font-fami ly:Arial;f ont-size:X -Small;fon t-weight:b old;height :24px;widt h:144px;"> </span>
<table cellspacing="0" cellpadding="4" rules="all" bordercolor="DarkRed" border="1" id="grdItems" style="color:DarkRed;backg round-colo r:White;bo rder-color :DarkRed;b order-widt h:1px;bord er-style:N one;font-f amily:Aria l;font-siz e:XX-Small ;height:88 px;width:6 16px;borde r-collapse :collapse; ">
<tr align="Center" style="color:#FFFFCC;backg round-colo r:#990000; font-weigh t:bold;">
<td>Rownbr</td><td align="Center" style="width:20mm;">Item</ td><td align="Center" style="width:100mm;">Descr iption</td ><td style="width:20mm;">Quanti ty</td><td >Jewelers Cost</td><td>Ext Cost</td><td>Delete</td>
</tr><tr style="color:#330099;backg round-colo r:#FFFFCC; ">
<td>Totals</td><td> < /td><td>&n bsp;</td>< td>0</td>< td>$0.00</ td><td>$0. 00</td><td > </t d>
</tr>
</table></P>
<P>
<input type="submit" name="cmdBack" value="< Back" id="cmdBack" style="height:40px;width:1 20px;" />
<input type="submit" name="cmdNext" value="Post and Print >" id="cmdNext" onclick="return confirm('Are you sure you want to Post Data?');" style="height:40px;width:1 20px;" />
<input type="submit" name="cmdCancel" value="Cancel" id="cmdCancel" onclick="return confirm('Are you sure you want to cancel');" style="height:40px;width:1 20px;" />
<input type="submit" name="cmdDone" value="Done" id="cmdDone" disabled="disabled" style="height:40px;width:1 20px;" /></P>
</div><span id="lblVal" Value="0" style="height:16px;width:1 04px;Z-IND EX: 110; LEFT: 680px; POSITION: absolute; TOP: 152px"></span><script language=JavaScript>if(con firm('Plea se click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='+& strCustID&+'&&SiteID='+& strSiteID& ;}</script>
</form>
</body>
</HTML>
<script language=JavaScript>docume nt.forms(0 ).elements ['txtItem' ].focus(); </script>< script language=JavaScript>docume nt.forms(0 ).elements ['txtItem' ].focus(); </script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>TJR Online: Enter Items</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout
<form name="Form1" method="post" action="frmSale.aspx?SiteI
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwtNjE4Mzg1NzE3O3Q
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.valu
theform.__EVENTARGUMENT.va
theform.submit();
}
// -->
</script>
<span id="LblReportCaption" style="color:DarkRed;font-
<HR style="Z-INDEX: 102; LEFT: 12px; WIDTH: 99.95%; POSITION: absolute; TOP: 100px; HEIGHT: 1px"
width="99.95%" color="#663333" SIZE="1">
<HR style="Z-INDEX: 103; LEFT: 235px; WIDTH: 76.47%; POSITION: absolute; TOP: 59px; HEIGHT: 1px"
width="76.47%" color="#663333" SIZE="1">
<a id="lnkHome" href="javascript:__doPostB
<P style="FONT-SIZE: medium; COLOR: #720000; FONT-FAMILY: Arial">Please enter the
Items.</P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblSaleType" style="color:DarkRed;font-
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblTerm" style="color:DarkRed;font-
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="Label1" style="color:DarkRed;font-
<input name="txtItem" type="text" id="txtItem" tabindex="1" style="TEXT-TRANSFORM: uppercase" />
<input type="submit" name="cmdSale" value="Enter Sale" id="cmdSale" style="width:80px;" /></P>
<P style="FONT-WEIGHT: bold; FONT-SIZE: x-small; COLOR: #720000; FONT-FAMILY: Arial">
<span id="lblErrorMsg" style="color:Red;font-fami
<table cellspacing="0" cellpadding="4" rules="all" bordercolor="DarkRed" border="1" id="grdItems" style="color:DarkRed;backg
<tr align="Center" style="color:#FFFFCC;backg
<td>Rownbr</td><td align="Center" style="width:20mm;">Item</
</tr><tr style="color:#330099;backg
<td>Totals</td><td> <
</tr>
</table></P>
<P>
<input type="submit" name="cmdBack" value="< Back" id="cmdBack" style="height:40px;width:1
<input type="submit" name="cmdNext" value="Post and Print >" id="cmdNext" onclick="return confirm('Are you sure you want to Post Data?');" style="height:40px;width:1
<input type="submit" name="cmdCancel" value="Cancel" id="cmdCancel" onclick="return confirm('Are you sure you want to cancel');" style="height:40px;width:1
<input type="submit" name="cmdDone" value="Done" id="cmdDone" disabled="disabled" style="height:40px;width:1
</div><span id="lblVal" Value="0" style="height:16px;width:1
</form>
</body>
</HTML>
<script language=JavaScript>docume
Try
location.href='frmCreditLi mit.aspx?C ustID='+st rCustID+'& &SiteID='+ strSiteID ;
location.href='frmCreditLi
ASKER
No still getting synatx error.
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID=C000 029&SiteID =R000010'; }"
this works fine so that means we are missing something while passing the variable..
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='+st rCustID;}"
This does give me a message box but then I get the error "strCustID is not defined"
Thanks for ur help so far!
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
this works fine so that means we are missing something while passing the variable..
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
This does give me a message box but then I get the error "strCustID is not defined"
Thanks for ur help so far!
if strCustID is a asp variable?
try this
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='+<% = strCustID%>;}"
try this
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
ASKER
Guess what!! its working .
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi mit.aspx?C ustID='+"" " & strCustID & """+'&SiteID='+ """ & strSiteID & """ ;}"
Thanks for guiding me in the right direction.
I tried
strScript += "if(confirm('Please click OK to enter the approval code to change the credit limit. ')){ location.href='frmCreditLi
Thanks for guiding me in the right direction.
Oh cool!
thanks for the points and the grade
thanks for the points and the grade
and post that