disable button from submitting multiple time - asp.net

I have created a visual webpart which means it has not form / body element in it. I have three submit buttons on the webpart. At one time, only one of there three button is visible. These button performs validation on multiple controls that are added on the webpart and then call server side methods.
Issue is that it takes time for webpart to submit and during this user can press submit button more than once which result is malfunction of the application.
I have tried jQuery solutions like adding disable attribute to submit button but it stops webpart from submitting as well.
Any help to stop multiple submit.

You can consider using Ajax for posting your form.
And, until some processing is going on server, disable UI & show a Loading Image.
Refer:
jQuery.ajax()
UpdatePanel Control Overview
UpdateProgress Control Overview

Related

Page does not move to top update panel inside user control

I have a user control on a ASP.NET page. Inside the user control there is a update panel. The page is a little lengthy and has Validation Summary control at the top.
The Submit button is at the bottom of the page. When I click the submit and when client side validation fails (on requiredfieldvalidators), the page DOES NOT move to the top where the Validation Summary control shows the messages. It just moves till the user control which is in the middle of the page.
I tried settings MaintainScrollPositionOnPostback="true" on the aspx page, but that didn't work.
How can I make it so when client-side validation fails, it moves to the top of the page?
Thanks
If the validation fails try to focus a control that is near the validation summary, maybe that work. ie. txtName.Focus(). If the validation is happening in the client side, try to do some js to detect when the summary appears....

jquery ajax not working after postback

Hi Here is the scenario:
I have an asp:Button on the page, and on clicking on the button, it verifies certain logic and displays a details block. This details block has bunch of web user controls, which make their own jquery ajax calls and load different controls using jquery templating plugin.
The details panel is inside a asp:Placeholder and i set visible property to true on postback.
The details panel was working fine earlier since i did not had a button click which does a postback to load the details panel. It was displayed by default earlier. How do i get my web user controls make an ajax call after the postback completes?
I got it working. I just added a hidden field on the page, and on postback i filled it with some value. On jquery instead of calling the functions directly on document ready, i checked what is the value set to the hidden field. This resolved the issue.

ASP.NET Page causes validation errors when navigating to another page - tab

I have a couple of pages with standard asp.net validation controls such as RequiredFieldValidator etc inside my RadAjaxPanel.
As soon as I navigate to another tab in my RadTabStrip the page seems to force validation errors and pretty much "locks" the page even though non of the fields was selected to enter data.
Only once all the required fields was entered the page seems to release the "lock" and only then am I able to navigate to another tab / page without even submitting the page.
Any idea what might be causing the "lock" and forced validation errors on the page?
Thanks
The RequiredFieldValidators are failing as the fields are empty. These validators are fired client side and so they're stopping the postback (which will change your tab) from occurring.
I'm not sure how the tabbing works on a RadTabStrip, but for normal ASP Buttons there's a "CausesValidation" property on the button. If you set it to false, it'll stop any validators from being fired when pressed.

Prevent Postback in array of linkbutton is created at dynamically

i have created Array of Linkbutton
and when user click on link button it will create an array of Radio Buttons
but it requires Postback all time so page load takes more time...
what is solution of it??
Use asp.net Ajax update panel.
Put link buttons and panel/view (or what ever control you are using ) update panel.
I am not sure if I am following a 100% but if you don't want to do a post back then your going to need to write some javascript(or use a framework like jquery) to generate radio buttons when the user clicks the link button(plus you probably don't want to use a link button then as it will try to always cause a postback or you will need to stop the post back from happening).

Passing data to server code from a client-side control using ASP.NET AJAX

I have a ListView on a page that displays a list of widgets. When a user clicks on one of the items in the list, I want to display a ModalPopup that contains controls allowing the user to operate on the item they selected.
I could easily accomplish this by placing a Panel and a ModalPopupExtender in the ListView's ItemTemplate, but this mean one set of hidden controls for each and every widget, which would massively bloat the page size. (There are going to be some rather heavyweight controls in there.) Instead I want to reuse a single ModalPopup for each of the widgets in the list.
I've done some searching but I haven't found anything that applies directly to my situation before. From what I've been able to figure out, however, I have to do something like this:
Place a Panel and a ModalPopupExtender on the page inside an UpdatePanel.
Build a custom WidgetManipulator user control that has a WidgetID property. Put this in the Panel, along with a couple OK/Cancel buttons.
In Javascript on the page, attach a click handler to each widget in the ListView that triggers a postback on the UpdatePanel.
On the UpdatePanel_Load event on the server, display the ModalPopup and then set the WidgetID propety on the WidgetManipulator to the ID of the clicked widget.
On the OKButton_Click event or CancelButton_Click event on the server, hide the ModalPopup. If OKButton was clicked, call WidgetManipulator.SaveChanges() first.
The part I haven't figured out is: How the heck do I know what widget was clicked on, and how do I pass that back to the server when I refresh the UpdatePanel? Is this even the right approach at all?
If you can use jQuery instead you could do something along the lines of these two posts:
Modal Delete Confirmation Version
Two Using jQuery SimpleModal Plugin
Demo
Inserting Content Using
jQuery SimpleModal Plugin Demo
When I need to pass data from client to server in ASP.NET AJAX, I generally use an asp:HiddenField with runat="server". Both can see it freely, but beware potential postback asynchronicity.
Sounds like you need to notify the server the widget was clicked - You may use a Timer to postback; or I'd go with option 5.

Resources