This is a migrated thread and some comments may be shown as answers.

ajaxRequestWithTarget for invisible button causes postback?

8 Answers 206 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Greg Chung
Top achievements
Rank 1
Greg Chung asked on 11 Jun 2008, 09:03 PM
I've begun experimenting with using RC for ASP.NET AJAX over the classic RC.  I've found one scenario where our old technique, with RadAjaxManager 1.7 would properly refresh a page without a visible postback, but with the new 2008.1.415, I do get a visible postback.

The scenario is as follows:
I have a page with a visible="false" button.  I have configured the RadAjaxManager to handle this button and update other fields.  I have script which previously invoked the following:

RadAjaxManager1.AsyncRequest('<%= myButton.UniqueID %>', '');

This worked fine with 1.7. 

Under 2008.1.415, I have changed the script to use ajaxRequestWithTarget instead of AsyncRequest.  When the script runs, the page does a full repost.  I have observed that if I make the button visible="true" instead, the page updates without the visible postback.

Am I doing something wrong?  Should I be using something other than ajaxRequestWithTarget?  Should I not be attempting a submit on an invisible button at all?  My real usage scenario is an extension of this -- I have a "main" browser window, and several child windows.  The child windows can have the main page update itself in various ways by triggering one of these invisible buttons.  It would be a problem for me if this model won't work any longer.

Thanks

8 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 12 Jun 2008, 01:12 PM
Hello Greg Chung,

RadAjaxManager relies on the HTML output of controls to be updated, that's why you need to put the control that should be updated in an always visible container like ASP Panel. Actually this is the way in which RadAjaxManager has always worked.

Best wishes,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Greg Chung
Top achievements
Rank 1
answered on 12 Jun 2008, 03:29 PM
Hi

I think you misunderstood what I was doing.  The controls to be updated are visible.  However, I was triggering the update by simulating a submit of an invisible button.

What confuses me is that it works fine with the old 1.7.2 RadAjaxManager, but not with the 2008.1.415.  Are you saying this technique never should have been working in 1.7.2?  I've created two example pages demonstrating the difference -- I'll upload them into a support ticket so you can see what I mean.

Thanks

0
Maria Ilieva
Telerik team
answered on 13 Jun 2008, 11:13 AM
Hi Greg Chung,

I reviewed the application you have sent us and answered to your support ticket. Please review the proposed solution and let us know if this helps.

Greetings,
Maria Ilieva
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Greg Chung
Top achievements
Rank 1
answered on 13 Jun 2008, 03:54 PM
Your solutions worked great, thanks very much.

I'm going to use the second idea:
Keep the button visible=true, but assign it a css class with display:none and visibility:hidden.

Thanks

0
Aleksandar
Top achievements
Rank 1
answered on 07 Oct 2008, 08:58 AM
Can you post solution here please?

Alex
0
Maria Ilieva
Telerik team
answered on 07 Oct 2008, 10:41 AM
Hi Aleksandar,

Please find below the provided solution:

"A possible workaround for this issue is to use "OnAjaxRequest" event of the RadAjaxManager in opposite of the OnButtonClick for triggering the necessary action. In this way you should add the RadAjaxManager as Target for the AjaxRequest and avoid using the invisible button as initiator.

Another possibility is to set particular hidden style for the button and not set "Visible=false" in it declaration.
For example:

<style>

.test {

display:none;

visibility:hidden;

}
</style>

In this way you could keep the OnButtonClick event for triggering the action and set the Button as target in the AjaxRequest.

Please find attached a sample application, which represents my implementation of the both suggestions.
"


Best wishes,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Quim
Top achievements
Rank 1
answered on 29 Oct 2008, 05:04 PM
Hi

I have a similar situation, but with a MasterPage and ContentPage.

The button used by ajaxRequestWithTarget is visible and is located in content page. This button changes MasterPage controls like I want, but he fires always a postback to ContentPage.

In my content page I also have a Multipage control with severall RadSplitter where I show several Windows that may change MasterPage controls (acessing javascript function that uses ajaxRequestWithTarget). All the windows work ok, but always with a postback on ContentPage.


Regards


0
Maria Ilieva
Telerik team
answered on 30 Oct 2008, 02:41 PM
Hi Quim,

Will it be convenient for you to open a regular support ticket and send us sample runnable project which replicates the described behaviour. We will make some local tests and do our best to provide accurate solution.

All the best,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Greg Chung
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Greg Chung
Top achievements
Rank 1
Aleksandar
Top achievements
Rank 1
Quim
Top achievements
Rank 1
Share this question
or