Click here to Skip to main content
15,905,420 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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"/>



C#
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
   if (IsValid() && isLineValid)
   {
      if (null != multiDocViewModelConnector.ViewState && multiDocViewModelConnector.ViewState.FilterDescripter != null)
                    multiDocViewModelConnector.ViewState.FilterDescripter.Clear();
      __searchCriteria();
   }
  }
Posted
Updated 22-Jun-11 2:58am
v2

Try this

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

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

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


Cheers,
Balaji
 
Share this answer
 
Comments
thatraja 16-Jul-11 23:09pm    
5!
Here is one Simple Solution... Just Try It..

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

--> Use One more Button "Clear"
--> And Inside btnClear_Click Event Mention
btnSearch.Enabled = true
 
Share this answer
 
Comments
Member 4550493 23-Jun-11 5:09am    
Hi All, Thanks for replying but i want the solution for silverlight because OnClientClick event is not available foe Button control in silverlight.Also, I hav tried for IsEnabled=True and IsEnabled=False property but its not working.Please provide solution for silverlight as i have provide my code with this Question.As you have mentioned to do IsEnabled=false in SearchButton Click Event and Enable it on clear button click Event but thats not the perfect solution because it is not compulsory to click clear button after clicking the Search button.beacause he can enter the different order no.Waiting for Reply.
Thanks,
Umesh Tayade
thatraja 16-Jul-11 23:09pm    
What's wrong with these answers, Don't know why downvotes for these, Counter 5!
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">


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

Button1.enabled="True"
.
 
Share this answer
 
Comments
JV9999 22-Jun-11 9:37am    
This does not prevent double clicking, because there still can be a large time window in which the button can be double clicked and believe me: users are able to do that without any problem.

Even worse is that you are giving an HTML example while the author requests a Silverlight solution.
thatraja 16-Jul-11 23:09pm    
What's wrong with these answers, Don't know why downvotes for these, Counter 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900