problem with use of UpdateProgress1

Posted by Vahidbakhtiary under ASP.NET AJAX on 2/10/2012 | Points: 10 | Views : 1242 | Status : [Member] | Replies : 1
hi
i use of this code for fetch value from database :
<style type="text/css">
.progresspanel
{
background-color: RED;
color: White;
top: 1px;
color: white;
position: absolute;
right: 16px;
z-index: 900;
}
</style>

<script type="text/javascript">
function showCustomer() {

var e = document.getElementById('<%=DropDownList1.ClientID%>');
var str = e.options[e.selectedIndex].value;

var xmlhttp;
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
}
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("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "getcustomer.aspx?q=" + str, true);
xmlhttp.send();
}
</script>


/////////////////////


<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList >

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="Panel" DisplayAfter="0" DynamicLayout="True">
<ProgressTemplate>
<div style="width:100px;height:30px;" class='progresspanel'>
Loading...
</div>
</ProgressTemplate>
</asp:UpdateProgress>

<asp:UpdatePanel runat="server" id="Panel">
<ContentTemplate>

<input type="button" value="ok" id="UpdateButton" runat="server" OnServerClick="UpdateButton_Click" onclick="showCustomer();"/>

</ContentTemplate>
</asp:UpdatePanel>


protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
DropDownList1.Items.Add("jenifer");
DropDownList1.Items.Add("dani");
}
}
protected void UpdateButton_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}

and when i click on button display both of them (Loding..... and my result ) but i want first dispaly loding.... and after that display my result

please help me




Responses

Posted by: Rajkatie on: 3/6/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
why u need to call client-side event onClick. just remove and try it

Rajesh Patel
.Net Trainer(MSCD | MCT | MS)
Brainbench (Asp.Net 4.5 and C# 5.0)

Vahidbakhtiary, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response