简体   繁体   中英

Asp.net connection

i have an asp.net website where thers an apply button and the webpage uses microsoft sql. The problem is that when the user clicks the apply button for a very long time right about 80-100 times, the webpage usually seems to lose connection and takes forever trying to load the page, and then either says a connection is close or timeout error.

Any ideas? Only happens if the user clicks the apply button for a very long time, but if i wait for like 2-5 mins and reopen the browser, everything works fine again

Do you want the functionality by which use can click the button twice. Why don't you think of disabling the button once it is clicked and update the text to 'Processing.....'

You can do as follows...

Considering you have a button with ID="ButtonProcess" runat="server"

Add the script as following

    <script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $('input[id*=ButtonProcess]').click(function() {
                //Your logic goes here to change text, do validation, bla bla bla.....
                $('input[id*=ButtonProcess]').attr('className', 'processbookingbutton');
                $('input[id*=ButtonProcess]').attr('disabled', 'disabled');
        });
    });
</script>

So, disabling the button and replacing the text with "Processing....." gives the user indication that you have already clicked the button and now wait for the output. You can also use UpdatePanel and UpdateProgress controls to make it more user friendly.

Hope this helps....

Sounds like you aren't managing DbConnection properly. Show us your data access code, specifically how you are opening/closing connections.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM