prince raj

prince raj

  • NA
  • 88
  • 44.9k

search Button require two click instead of one.

Jun 16 2014 4:00 AM
<html>
<head>
function showCustomer() {
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("loading").innerHTML = ''; // hide loading images
document.getElementById("content").innerHTML = xmlhttp.responseText;
}
}
document.getElementById("loading").innerHTML = '<img src="images/preloader.gif" />'; // loading images
xmlhttp.open("GET", "page2.aspx?&SizeFrom=" + SizeFrom + "&SizeTo=" + SizeTo, true);
xmlhttp.send();
}
var SizeFrom;
var SizeTo;
 
function filter() {
document.getElementById("Button1").click();
SizeFrom = $("#lbl_SizeFrom").text();
SizeTo = $("#lbl_SizeTo").text();
showCustomer();
}
</head>
<body>
<!---
content
-->
<asp:Button ID="Button1" runat="server" Text="Button" onclick="btn1_Click"></asp:Button><br />
<img onclick="filter()" src="images/search.png" />
<%
void btn1_Click(Object sender, EventArgs e)
{
lbl_SizeFrom.Text = txt_sizefrom.Text.ToString();
lbl_SizeTo.Text = txt_sizeto.Text.ToString();
}
%>
</body>
</html>
---------------------------
page2.aspx
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = -1;
object obj_SizeFrom = Request.QueryString["SizeFrom"];
string str_SizeFrom = obj_SizeFrom.ToString();
object obj_SizeTo = Request.QueryString["SizeTo"];
string str_SizeTo = obj_SizeTo.ToString();
Response.Write(str_SizeFrom + "<br/>");
Response.Write(str_SizeTo + "<br/>");
}
---------------------------
its Work Completely, but problem is Search image require two click.
Why ?

Answers (1)