避免多次单击按钮 [英] Avoiding Multiple Clicks of Button

查看:81
本文介绍了避免多次单击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我具有搜索顺序"的搜索"按钮.当我输入订单号和订单类型并单击提交按钮时,它将显示该订单号的文档.但是,应用程序的问题是当我同时单击搜索"按钮时它会复制数据.我想避免复制单击多个按钮上的数据.

谢谢,
乌梅什·塔亚德

Hi,

In my application i have Search button for Search Order. When i enter the Order no and order type and click submit button then it shows the documents for that order no.But,The Problem with the application is when i click the Search button simultaneously it replicates the data.I want to avoid the replication of the data on multiple button click.

Thanks,
Umesh Tayade

<Button Content="Search"  Margin="5,0,0,0" Height="21" Width="100" Grid.Row="0" Grid.Column="9" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource grayButton}" x:Name="btnSearch" Click="btnSearch_Click"/>







private void btnSearch_Click(object sender, RoutedEventArgs e)
{
   if (IsValid() && isLineValid)
   {
      if (null != multiDocViewModelConnector.ViewState && multiDocViewModelConnector.ViewState.FilterDescripter != null)
                    multiDocViewModelConnector.ViewState.FilterDescripter.Clear();
      __searchCriteria();
   }
  }

推荐答案

尝试一下

Try this

<asp:Button runat="server" ID="BtnSubmit"

  OnClientClick="this.disabled = true; this.value = 'Submitting...';"
 UseSubmitBehavior="false"

  OnClick="BtnSubmit_Click"
 Text="Click Me Once!" />



干杯,
Balaji



Cheers,
Balaji


这里是一个简单的解决方案...试试吧..

->内部btnSearch_Click事件提及
Here is one Simple Solution... Just Try It..

--> Inside btnSearch_Click Event Mention
btnSearch.Enabled = false


->再使用一个按钮清除"
->和btnClear_Click事件提及内


--> Use One more Button "Clear"
--> And Inside btnClear_Click Event Mention

btnSearch.Enabled = true


使用常规的HTML按钮,包括Runat ="server"和"OnServerClick"事件名称-像这样:

Use a regular HTML button, including a Runat="server" and an ''OnServerClick'' event designation - like this:

<INPUT id="Button1" onclick="document.form1.Button1.disabled=true;" type="button" value="Submit - Insert Data" name="Button1" runat="server" onserverclick="doInsert">



然后,在"doInsert"子例程的最后一行中,添加此行



Then, in the very last line of the ''doInsert'' subroutine, add this line

Button1.enabled="True"

.


这篇关于避免多次单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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