用于显示加载gif而asp:按钮回发的代码 [英] code for showing loading gif while asp:button postback

查看:78
本文介绍了用于显示加载gif而asp:按钮回发的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在asp:按钮附近显示加载gif,当页面获得回发时,

我没有使用updatepanel而且也不想使用它。



我有wriiten代码为

Hi,
I want to show loading gif near to asp:button ,when the page get postback ,
I am not using updatepanel and also dont want to use it.

I have wriiten code as

 <div id="divShowLoadingGif"  runat="server"  style="display:none; ">
        <img id="img2" alt="" src="Ajax_spinner.gif" style="display: inline; height: 16px;" />
       </div>

<asp:Button ID="btnUpload" runat="server" ValidationGroup="u"  OnClick="btnUpload_Click" OnClientClick="showloadingGif_UPLOAD();return true;"  Text="Upload"  />





javascript code



javascript code

function showloadingGif_UPLOAD() {

     
      document.getElementById('divShowLoadingGif').style.display = 'inline';
      return true;
  }





和服务器端代码



and the server side code

protected void btnUpload_Click(object sender, EventArgs e)
  {

// my code here

  }





我的代码在IE和MOZILLA中工作,但它不能用于谷歌浏览器。

在谷歌浏览器中,只有客户端代码被执行但服务器端代码没有被执行。



我有几个按钮,我想显示加载附近的gif用户单击asp.net按钮时的asp.net按钮



请帮助



my code is working in IE AND MOZILLA but its not working in google chrome .
In google chrome only clientside code is getting exucuted but server side code is not getting executed.

I have several button where i want to show loading gif near to the asp.net button whenver user click asp.net button

Please help

推荐答案

尝试asp进度bar代替java脚本函数。
try asp progress bar in place of java script function.


这篇关于用于显示加载gif而asp:按钮回发的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆