避免多次单击按钮

编程入门 行业动态 更新时间:2024-10-10 09:22:10
本文介绍了避免多次单击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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"

.

更多推荐

避免多次单击按钮

本文发布于:2023-10-19 17:46:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508297.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!