Jquery Tools Tabs: How to capture onClick event when selection is on current tab? - jquery-tools

I tried to ask this question on the jquery tools forum, but didn't get a response, hopefully someone here can help.
Question:
It seems the onClick event does not get fired when user is already on current tab, I think that make sense for most cases. However, in my case, I do want to capture the onClick event even when the curent tab is already the selection.
Is there a way to do this?
Thanks!

You can always bind the onClick event to the anchor tags themselves rather than to the tabs events.

Related

Button in CustomControl added in OnClick doesn't postback until second click

I have the following scenario:
UserControlA contains a <asp:Button id="bSomeid" onClick="AddItem" /> with some code to an item to a shopping basket in AddItem.
UserControlB contains some LinkButton's that dynamically add a selection of UserControlA to the page in the OnClick event.
This is all done in an UpdatePanel. It is a little more complicated but I have pruned the information to what I believe is causing the problem, I will add more information if necessary.
The problem I have is that it takes 2 clicks for the AddItem event to trigger after I have added the items to the page after clicking the LinkButton.
I understand why this is happening - it is to late in the page cycle to register events for the next post back in the onclick - but can anyone think of a way around this? Can I force an event to be triggered on the next postback? I have tried to think of a way to run my code in page_load but I requuire access to the sender in the onClick.
Using .NET 4.0.
EDIT
I managed to find a way to get the link button sending the request in the Page_Load (using Request.Form["__EVENTTARGET"];) so I moved my code to the Page_load event. It still requires 2 clicks so I am assuming it isn't something to do with the onClick being registered to late.
Are there any other general things to check that could cause a button to require 2 clicks to post an event properly?
If your suspicion about being late in page life cycle is true then you can try using ScriptManager.RegisterAsyncPostBackControl method to register dynamically added controls in the link button click - considering that your button is within user control, you need to add public method into UserControlA that would actually register the button bSomeid1 and link button click from UserControlB would actually call the A control's method.
EDIT :
Another cause for button click not happening can be that button being dynamic control is not added in the page hierarchy when post-back happens (or it gets added very late in the page life cycle when the post back data is already processed). A really full-proof solution should add dynamic controls back to the page hierarchy in page_load it-self (and strictly maintaining same controls ids within hierarchy). If that's not possible then you can sniff the request (Request.Form) to detect the post-back.
In your case, you should ascertain if the button is indeed causing the post-back on each click. If yes, what is the POST data (Request.Form) for the first request - what is the __EVENTTARGET value on the first click (and post-back)? That should start your trouble-shooting.
On the other hand, a simple work-around could be to use html anchor element (you can still use link button) and have a javascript handler in the click event that would set some hidden variable and then submit the form (you can simulate the click on hidden button to trigger ASP.NET client side submit pipeline) . Now the hidden variable value can be used on the post-back to determine which link button has been clicked.
"Are there any other general things to check that could cause a button to require 2 clicks to post an event properly?"
Does it require two clicks on the control, or does it take accept a single click elsewhere on the screen, and then fire first time with a single click on the control?
I have my own (similar) issue with the Updatepanel where the first (expected) trigger does not fire and it seems that a single click elsewhere, and then the subsequent triggers fires first time (which totals 2 clicks)
[edit] Since you are working on this ATM, it may help me as well. Do you have a textbox with a trigger event on it? I do, and if I leave this blank (so that it does not fire) then there is no need for a second click.

Disable Gridview Row

The problem I am having is in a gridview I have multiple buttons and some dropdowns. Anytime the buttons or dropdowns are acted upon, I need either the entire row to be disabled until the postback completes, or all the items in the row to be disabled until the postback is complete. The reason for this is that anytime there are multiple clicks or, essentially, multiple postbacks trying to occur, my page freezes up and requires a refresh. I'm really not even sure where to start so any help would be greatly appreciated. Thanks!
The application we are using is kinda old and we dont have jQuery. I talked to my team lead about it and he says we can try it but it would have to get approved from the higher ups and that may take a while. Any other ideas?
You can use jQuery to disable the button on submit:
$('form').submit(function(){
$(':submit', this).click(function() {
return false;
});
});
You could also use the jQuery plugin BlockUI which prevents that you can click anything then.

Overriding a radgrid row with a sliding popup when i click on delete option

I have a problem with radGrid Control..
According to my clients requirement we are displaying data in radGrid. But what my problem is, when we click on delete button, the row which has to be delete should be replace with a sliding popup asking " Are u sure you want to delete this row" and with two buttons.
I have tried a lot, but I didn't get any solution for that..
Can any one please help me..
Well, do you have to have a "sliding" popup? In-built it supports a nice radwindow element for the prompt, which you may be able to programmably slide. Set these properties on the gridcommandcolumn: ConfirmTitle="Delete Medical Home" ConfirmDialogType="RadWindow". Otherwise, you can give the button an OnClientClick value that fires a function to show the prompt, and manually control the postback for the delete. For the latter this requires some research, I'm not exactly sure how that works with the RadGrid (the postback to submit the command).
HTH.
Brian

asp.net crosspage postback on click doesn't run

I am trying to get a crosspage postback to work in asp.net 2.0 the issue I seem to be having is the button that I press is meant to use it's on click event to store some session variables based on the values of other controls. This button has crosspage postback property to the relevant page.
The on click event seems to not run at all, it just seems to perform the postback to the other page straight away.
Is this standard behavior? Any work around?
I think I have found my answer
http://community.sgdotnet.org/blogs/chuawenching/archive/2007/03/08/ASP.NET-2.0-DataGrid_2F00_GridView-CrossPage-PostBack-.aspx
Seems like the transfer will be instant, no onClick event will run. The alternative is to use Server.Transfer in the onClick event.
Any other comments appreciated.

Two ModalPopupExtenders on a page cause incorrect validation issues

I have one aspx page that has two UserControls on it; each is primarily a ModalPopupExtender. One has validators; one does not. The one that does not has a Submit button with the CausesValidation="false" attribute on it.
When that Submit button is clicked, nothing happens. Click it again, and the postback happens as expected. There is clearly some validation issue going on here, because if I remove all validators from the page, the postback succeeds on the first click.
What's going on here?
Without seeing the code, I can't say this for certain, but it sounds like you may need to utilize the validation groups. The validation group would be set on the validation components as well as the button that posts back the page.
Make sure that the buttons that show the ModalPopups are marked CausesValidation=false as well. What was happening was that the "Show Dialog" button for the non-validating dialog was not marked this way; this was causing the entire page to validate when that dialog was shown - including the other dialog, which did have validation and was failing it. This caused the Submit button to fail for apparently no reason.
Moral of the story: Make sure to use CausesValidation on any buttons that don't require it, and use Validation Groups to separate out various page parts, especially when parts of the page are not visible.
Have you tried removing the OK button property from the modal popup?

Resources