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

[Solved] Unwanted Ajaxification?

5 Answers 173 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Miha Markic
Top achievements
Rank 1
Miha Markic asked on 21 Nov 2007, 09:16 AM
Consider the code below. I hava a link button and a panel below it. I instruct RadAjaxManager to use link button as a source and panel as a target of ajax postback. So far so good. But if I click in button "Postback" which resides inside the panel, I get an ajaxified postback, too - note, the only ajax linke is between link button and panel, no other instructions exist. Is this by design?
Furhter notes: I have a similary structured (big) project and it works like described above plus one problem: whenever I define a link from panel to (same) panel I get an object not set exception ( see my previous post).

<div>

<asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>

<asp:LinkButton ID="LinkButton1" runat="server">Ajax to bottom panel</asp:LinkButton>

<asp:Button ID="Button2" runat="server" Text="No Ajax, just postback" />

<asp:Panel

ID="Panel1" runat="server" Height="50px" Width="398px" BackColor="#E0E0E0">

Bottom panel<br />

<asp:Button ID="Button1" runat="server" Text="Postback" OnClick="Button1_Click" />

<asp:TextBox ID="ASPxLabel1"

runat="server" Text="ASPxLabel">

</asp:TextBox>

</asp:Panel>

<asp:TextBox ID="ASPxLabel2"

runat="server" Text="ASPxLabel">

</asp:TextBox>

</div>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="LinkButton1">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="Panel1" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel id="RadAjaxLoadingPanel1" runat="server" Width="75px" Height="75px">

<asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/RadControls/Skins/Default/Ajax/loading1.gif" />

</telerik:RadAjaxLoadingPanel>

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 21 Nov 2007, 11:29 AM
Hi Miha,

Again this is inherited from the MS AJAX and is expected behavior. What our AjaxManager does is add UpdatePanel around the UpdateControl and set triggers for the initiator controls. Try this:

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:LinkButton ID="LinkButton1" runat="server">Ajax to bottom panel</asp:LinkButton>
        <asp:Button ID="Button2" runat="server" Text="No Ajax, just postback" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Panel ID="Panel1" runat="server" Height="50px" Width="398px" BackColor="#E0E0E0">
                    Bottom panel<br />
                    <asp:Button ID="Button1" runat="server" Text="Postback" OnClick="Button1_Click" />
                    <asp:TextBox ID="ASPxLabel1" runat="server" Text="ASPxLabel">
                    </asp:TextBox>
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="LinkButton1" />
            </Triggers>

        </asp:UpdatePanel>
        <asp:TextBox ID="ASPxLabel2" runat="server" Text="ASPxLabel">


Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Christopher Blickley
Top achievements
Rank 2
answered on 26 Nov 2007, 01:45 AM
Miha,

I had the same issue back when I first started using the Prometheus version.  Once I figured out what was happening, I was able to work around it.  There are instructions in the documentation for how to use some javascript to get around it. 

Since this is the way MS.AJAX works, it would be great if Prometheus could get around it somehow, perhaps by automating the javascript that we have to do ourselves now.  Perhaps a property that identifies controls that should always postback instead of ajax callback?  Perhaps there are too many veriables in making that work, but it seems like something that should be possible.

-Chris
0
Steve
Telerik team
answered on 26 Nov 2007, 02:43 PM

Yes Chris, this is something that is logged for investigation in our system and we will do our best to include it for the official Q3 release.

Thank you for the understanding and patience.

All the best,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Christopher Blickley
Top achievements
Rank 2
answered on 26 Nov 2007, 07:50 PM
Great news that it is being considered, it certainly isn't a showstopper, but would make things much easier (especially when upgrading from the classic Rad.Ajax to Prometheus).

Thanks,
Chris
0
UT_DEV
Top achievements
Rank 1
answered on 28 Nov 2007, 09:11 AM
It is a normal ajax behavior, but you cancel a postack in folowing way


Sys.Application.add_load(ApplicationLoadHandler);
function ApplicationLoadHandler(sender, args)
{
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(CheckStatus);
}

function CheckStatus(sender, args)
{
if(args.get_postBackElement().id == 'PlaceYourControlIDHere')
{
args.set_cancel(true);
}
}

Hope this will solve your issues.
args.get_postBackElement().id  contains id of an element that is raising postback

Tags
Ajax
Asked by
Miha Markic
Top achievements
Rank 1
Answers by
Steve
Telerik team
Christopher Blickley
Top achievements
Rank 2
UT_DEV
Top achievements
Rank 1
Share this question
or