I have a asp page where i have a button.When i click on the button i should display a gif image.When the process is pleted ,again the images has to be hidden.
Please find my below code behind
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="display: none" id="dvloader">
<img src="Images/process_status.gif" /></div>
<asp:Button ID="btnLoad" runat="server" Text="Load" OnClick="btnLoad_Click" />
</form>
</body>
Please find the below code behind
protected void btnLoad_Click(object sender, EventArgs e)
{
// Show the gif image
System.Threading.Thread.Sleep(5000);
// hide the gif image
}
How can i achive this ?
Thanks.
I have a asp page where i have a button.When i click on the button i should display a gif image.When the process is pleted ,again the images has to be hidden.
Please find my below code behind
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="display: none" id="dvloader">
<img src="Images/process_status.gif" /></div>
<asp:Button ID="btnLoad" runat="server" Text="Load" OnClick="btnLoad_Click" />
</form>
</body>
Please find the below code behind
protected void btnLoad_Click(object sender, EventArgs e)
{
// Show the gif image
System.Threading.Thread.Sleep(5000);
// hide the gif image
}
How can i achive this ?
Thanks.
Share Improve this question asked Nov 24, 2009 at 10:28 JebliJebli 2,8257 gold badges31 silver badges37 bronze badges 1- you need some progressbar like thing? – Muhammad Akhtar Commented Nov 24, 2009 at 10:35
2 Answers
Reset to default 3The method in your example is server-sided. What you want to do is on the client side and must be done in javascript therefore.
You could use the client-sided onclick-event to show the GIF after the button has been clicked. You can set the client-sided onclick-event somwhere in the Page-Load method for example:
btnLoad.Attributes.Add("onclick", "alert('JavaScript to show GIF goes here...');");
After the PostBack, the GIF will be hidden again automatically...
You could actually apply the event to the element without using the inline event handler.
Using jquery you could say:
$(document).ready(function() {
$('#btnLoad').click(function(){alert('JavaScript to show GIF goes here...');});
});
This assumes your button has an id of btnload.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745062684a4609062.html
评论列表(0条)