Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i need to now when i have one button & i need to send 3 parameters to other page i use location .href but don't work this is my code please help me

<script >

function btnExternalPayGhest_Click(id) {

if (id == 190) {

location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID +'&y='+ExternalGhestID +'&y=' +ExternalCellPhone;

}

else if (id == 240) {

location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&y=' + ExternalCellPhone;

}

}
</script>
<form name="form1">

<input type="button" name="بررسی" value="بررسی" >

</form>
Posted
Comments
Thomas Daniels 15-Aug-15 4:08am    
Does btnExternalPayGhest_Click actually get called? And what are the values of GhestCompanyID, ExternalGhestID and ExternalCellPhone?
Member 11686005 15-Aug-15 4:43am    
i have one form with 3 parameters( GhestCompanyID ,ExternalGhestID , ExternalCellPhone)i mean cstomer fill this 3 parameter when click to بررسی button i need send some parameters to other page
Black Mamba Elapidae 17-Aug-15 1:21am    
How are you calling btnExternalPayGhest_Click(id)?? have you checked by adding debugger on js , if all the values are available in function btnExternalPayGhest_Click(id) . Because location.href should work fine . And also on which browser are you testing this code.
Member 11686005 17-Aug-15 1:42am    
but don't work help me
Black Mamba Elapidae 17-Aug-15 2:03am    
Please post the code where you are calling js function btnExternalPayGhest_Click(id).

1 solution

I am still not sure about your question, But If I was to send 3 values from one page , This is what I would have done,

XML
<form id="form1" runat="server">
 <div>
     <input type="text" id="GhestCompanyID" value="GhestCompanyID" />
     <input type="text" id="ExternalGhestID" value="ExternalGhestID" />
     <input type="text" id="ExternalCellPhone" value="ExternalCellPhone" />
     <input type="button" name="aaaa" value="bbbb" onclick="btnExternalPayGhest_Click(190)" />
 </div>
 </form>


and write script like,

C#
function btnExternalPayGhest_Click(id) {
     var GhestCompanyID = document.getElementById("GhestCompanyID").value;
     var ExternalGhestID = document.getElementById("ExternalGhestID").value;
     var ExternalCellPhone = document.getElementById("ExternalCellPhone").value;
     if (id== 190) {

         location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&z=' + ExternalCellPhone;

         }

     else if (GhestCompanyID == 240) {

     location.href = 'http://www.tkhkportal.com/Login.aspx?ReturnUrl=default.aspx?x=' + GhestCompanyID + '&y=' + ExternalGhestID + '&z=' + ExternalCellPhone;

 }
}
 
Share this answer
 
Comments
Member 11686005 31-Aug-15 7:55am    
hi i use your solution bout my check bottom don't word please check my code to help me ?-----
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>PanelAghsat</title>
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<link href="Content/bootstrap-theme.min.css" rel="stylesheet" />
<link href="modern-business.css" rel="stylesheet" />
</head>
<body>
<form id="form2" runat="server">



<div class="row ">
<div class="col-md-4">

<div class="panel panel-default">
<div class="panel-heading wi">



<span class="fa fa-list fa-x colo1"></span>

پرداخت مستقیم اقساط با شناسه
<%-- <img class="new" src="img/2.gif" />--%>

</div>
<asp:Label ID="lblExternalGhestCaptchaMsg" Style="color: Red; font-weight: bold; padding-top: 50px;" runat="server" Text="">
<button class="btn btn-primary colo colo3" type="button" data-toggle="collapse" data-target="#collapseExample" >
<span style="padding-right: 30px; padding-left: 30px">تعــاونی خاص </span>
</button>


<button class="btn btn-primary colo colo3" type="button" data-toggle="collapse" data-target="#collapseExample" >
<span style="padding-right: 30px; padding-left: 30px">حامی الکترونیک </span>
</button>
<div class="collapse" id="collapseExample">
<div class="well1 ">
<input type="text" name="CompanyId" id="CompanyId" value="000" /><br />
شناسه قسط         <input type="text" id="ExternalGhestID" value="" /><br />
شماره تلفن همراه
<input type="text" id="ExternalCellPhone" value="" />
<input type="button" name="check" value="check" />
<img class="TABLET" src="img/1.jpg" id="imgCoAghsat" />

</div>
</div>
</div>
</div>
</div>
</form>

<div>
</div>


<!-- jQuery -->
<script src="Scripts/jquery-1.9.1.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="Scripts/bootstrap.min.js"></script>
<!-- Script to Activate the Carousel -->

<script>
function DetectCoAghsat(id) {

if (id == 190) {
var element1 = document.getElementById("CompanyId");

element1.value = "190";

var Img = document.getElementById("imgCoAghsat");
Img.src = "img/tavoni.png";

}
else if (id == 240) {
var element1 = document.getElementById("CompanyId");

element1.value = "240";

var Img = document.getElementById("imgCoAghsat");
Img.src = "img/Hami card.png";


}

}
</script>

<script>


function btnExternalPayGhest_Click(id) {
var CompanyID = document.getElementById("CompanyID").value;
var ExternalGhestID = document.getElementById("ExternalGhestID").value;
var ExternalCellPhone = document.getElementById("ExternalCellPhone").value;
if (id == 190) {


location.href = 'http://www.tkhkportal.com/frmInstallmentPayment.aspx?ReturnUr

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900